首页 > 其他分享 >Design各控件的搭配使用4

Design各控件的搭配使用4

时间:2023-04-12 21:01:45浏览次数:33  
标签:控件 setDuration 搭配 pop ObjectAnimator Design android main view


在上一个版本基础上添加两个Activity: EffectsActivity&TabLayoutActivity

EffectsActivity测试了一种效果;

TabLayoutActivity中使用的控件:
android.support.design.widget.TabLayout
android.support.v4.widget.NestedScrollView
android.support.design.widget.TextInputLayout

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class EffectsActivity extends AppCompatActivity implements View.OnClickListener{

	private Context context;
	
	private LinearLayout main_view;
	private LinearLayout pop_view;
	private int main_view_height;
	private int pop_view_height;
	private Button btn_show;
	private Button btn_hide;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test);
		context=this;
		main_view = (LinearLayout)findViewById(R.id.main_view);
		pop_view = (LinearLayout)findViewById(R.id.pop_view);
		btn_show = (Button)findViewById(R.id.btn_show);
		btn_hide = (Button)findViewById(R.id.btn_hide);
		btn_show.setOnClickListener(this);
		btn_hide.setOnClickListener(this);
		main_view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
	            @Override
	            public void onGlobalLayout() {
	            	main_view_height = main_view.getHeight();
	            	main_view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
	            }
		});
		pop_view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
	            @Override
	            public void onGlobalLayout() {
	            	pop_view_height = pop_view.getHeight();
	            	pop_view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
	            }
		});	
		
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btn_show:
			show();
			break;
		case R.id.btn_hide:
			hide();
			break;

		default:
			break;
		}
	}	
	
	private void show(){
        ObjectAnimator fViewScaleXAnim=ObjectAnimator.ofFloat(main_view,"scaleX",1.0f,0.8f);
        fViewScaleXAnim.setDuration(350);
        ObjectAnimator fViewScaleYAnim=ObjectAnimator.ofFloat(main_view,"scaleY",1.0f,0.8f);
        fViewScaleYAnim.setDuration(350);
        ObjectAnimator fViewAlphaAnim=ObjectAnimator.ofFloat(main_view,"alpha",1.0f,0.5f);
        fViewAlphaAnim.setDuration(350);
        ObjectAnimator fViewRotationXAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 0f, 10f);
        fViewRotationXAnim.setDuration(200);
        ObjectAnimator fViewResumeAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 10f, 0f);
        fViewResumeAnim.setDuration(150);
        fViewResumeAnim.setStartDelay(200);
        ObjectAnimator fViewTransYAnim=ObjectAnimator.ofFloat(main_view,"translationY",0,-0.1f* main_view_height);
        fViewTransYAnim.setDuration(350);
        ObjectAnimator sViewTransYAnim=ObjectAnimator.ofFloat(pop_view,"translationY",pop_view_height,0);
        sViewTransYAnim.setDuration(350);
        sViewTransYAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                pop_view.setVisibility(View.VISIBLE);
                btn_show.setEnabled(!pop_view.isShown());
            }
            
        });
        AnimatorSet showAnim=new AnimatorSet();
        showAnim.playTogether(fViewScaleXAnim,fViewRotationXAnim,fViewResumeAnim,fViewTransYAnim,fViewAlphaAnim,fViewScaleYAnim,sViewTransYAnim);
        showAnim.start();
    }	
	 
	private void hide(){
        ObjectAnimator fViewScaleXAnim=ObjectAnimator.ofFloat(main_view,"scaleX",0.8f,1.0f);
        fViewScaleXAnim.setDuration(350);
        ObjectAnimator fViewScaleYAnim=ObjectAnimator.ofFloat(main_view,"scaleY",0.8f,1.0f);
        fViewScaleYAnim.setDuration(350);
        ObjectAnimator fViewAlphaAnim=ObjectAnimator.ofFloat(main_view,"alpha",0.5f,1.0f);
        fViewAlphaAnim.setDuration(350);
        ObjectAnimator fViewRotationXAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 0f, 10f);
        fViewRotationXAnim.setDuration(200);
        ObjectAnimator fViewResumeAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 10f, 0f);
        fViewResumeAnim.setDuration(150);
        fViewResumeAnim.setStartDelay(200);
        ObjectAnimator fViewTransYAnim=ObjectAnimator.ofFloat(main_view,"translationY",-0.1f* main_view_height,0);
        fViewTransYAnim.setDuration(350);
        ObjectAnimator sViewTransYAnim=ObjectAnimator.ofFloat(pop_view,"translationY",0,pop_view_height);
        sViewTransYAnim.setDuration(350);
        sViewTransYAnim.addListener(new AnimatorListenerAdapter() {  
            @Override  
            public void onAnimationEnd(Animator animation) {  
            	 super.onAnimationEnd(animation);
            	 pop_view.setVisibility(View.INVISIBLE);
            	 btn_show.setEnabled(!pop_view.isShown());
            }
            
        });
        AnimatorSet showAnim=new AnimatorSet();
        showAnim.playTogether(fViewScaleXAnim,fViewRotationXAnim,fViewResumeAnim,fViewTransYAnim,fViewAlphaAnim,fViewScaleYAnim,sViewTransYAnim);
        showAnim.start();
    }

	public boolean isShown(){
		return pop_view.isShown();
	}
	
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		if(isShown()){
			hide();
		}else{
			super.onBackPressed();
		}
	}
	
	
}



import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class EffectsActivity extends AppCompatActivity implements View.OnClickListener{

	private Context context;
	
	private LinearLayout main_view;
	private LinearLayout pop_view;
	private int main_view_height;
	private int pop_view_height;
	private Button btn_show;
	private Button btn_hide;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_effects);
		context=this;
		main_view = (LinearLayout)findViewById(R.id.main_view);
		pop_view = (LinearLayout)findViewById(R.id.pop_view);
		btn_show = (Button)findViewById(R.id.btn_show);
		btn_hide = (Button)findViewById(R.id.btn_hide);
		btn_show.setOnClickListener(this);
		btn_hide.setOnClickListener(this);
		main_view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
	            @Override
	            public void onGlobalLayout() {
	            	main_view_height = main_view.getHeight();
	            	main_view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
	            }
		});
		pop_view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
	            @Override
	            public void onGlobalLayout() {
	            	pop_view_height = pop_view.getHeight();
	            	pop_view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
	            }
		});	
		
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btn_show:
			show();
			break;
		case R.id.btn_hide:
			hide();
			break;

		default:
			break;
		}
	}	
	
	private void show(){
        ObjectAnimator fViewScaleXAnim=ObjectAnimator.ofFloat(main_view,"scaleX",1.0f,0.8f);
        fViewScaleXAnim.setDuration(350);
        ObjectAnimator fViewScaleYAnim=ObjectAnimator.ofFloat(main_view,"scaleY",1.0f,0.8f);
        fViewScaleYAnim.setDuration(350);
        ObjectAnimator fViewAlphaAnim=ObjectAnimator.ofFloat(main_view,"alpha",1.0f,0.5f);
        fViewAlphaAnim.setDuration(350);
        ObjectAnimator fViewRotationXAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 0f, 10f);
        fViewRotationXAnim.setDuration(200);
        ObjectAnimator fViewResumeAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 10f, 0f);
        fViewResumeAnim.setDuration(150);
        fViewResumeAnim.setStartDelay(200);
        ObjectAnimator fViewTransYAnim=ObjectAnimator.ofFloat(main_view,"translationY",0,-0.1f* main_view_height);
        fViewTransYAnim.setDuration(350);
        ObjectAnimator sViewTransYAnim=ObjectAnimator.ofFloat(pop_view,"translationY",pop_view_height,0);
        sViewTransYAnim.setDuration(350);
        sViewTransYAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                pop_view.setVisibility(View.VISIBLE);
                btn_show.setEnabled(!pop_view.isShown());
            }
            
        });
        AnimatorSet showAnim=new AnimatorSet();
        showAnim.playTogether(fViewScaleXAnim,fViewRotationXAnim,fViewResumeAnim,fViewTransYAnim,fViewAlphaAnim,fViewScaleYAnim,sViewTransYAnim);
        showAnim.start();
    }	
	 
	private void hide(){
        ObjectAnimator fViewScaleXAnim=ObjectAnimator.ofFloat(main_view,"scaleX",0.8f,1.0f);
        fViewScaleXAnim.setDuration(350);
        ObjectAnimator fViewScaleYAnim=ObjectAnimator.ofFloat(main_view,"scaleY",0.8f,1.0f);
        fViewScaleYAnim.setDuration(350);
        ObjectAnimator fViewAlphaAnim=ObjectAnimator.ofFloat(main_view,"alpha",0.5f,1.0f);
        fViewAlphaAnim.setDuration(350);
        ObjectAnimator fViewRotationXAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 0f, 10f);
        fViewRotationXAnim.setDuration(200);
        ObjectAnimator fViewResumeAnim = ObjectAnimator.ofFloat(main_view, "rotationX", 10f, 0f);
        fViewResumeAnim.setDuration(150);
        fViewResumeAnim.setStartDelay(200);
        ObjectAnimator fViewTransYAnim=ObjectAnimator.ofFloat(main_view,"translationY",-0.1f* main_view_height,0);
        fViewTransYAnim.setDuration(350);
        ObjectAnimator sViewTransYAnim=ObjectAnimator.ofFloat(pop_view,"translationY",0,pop_view_height);
        sViewTransYAnim.setDuration(350);
        sViewTransYAnim.addListener(new AnimatorListenerAdapter() {  
            @Override  
            public void onAnimationEnd(Animator animation) {  
            	 super.onAnimationEnd(animation);
            	 pop_view.setVisibility(View.INVISIBLE);
            	 btn_show.setEnabled(!pop_view.isShown());
            }
            
        });
        AnimatorSet showAnim=new AnimatorSet();
        showAnim.playTogether(fViewScaleXAnim,fViewRotationXAnim,fViewResumeAnim,fViewTransYAnim,fViewAlphaAnim,fViewScaleYAnim,sViewTransYAnim);
        showAnim.start();
    }

	public boolean isShown(){
		return pop_view.isShown();
	}
	
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		if(isShown()){
			hide();
		}else{
			super.onBackPressed();
		}
	}
	
	
}



import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

public class TabLayoutActivity extends AppCompatActivity implements View.OnClickListener {

	private Context context;

	private TabLayout tabLayout;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tablayout);
		context = this;
		
		Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
		//使用了ActionBarDrawerToggle之后,下面的设置可以不用
		// App Logo
//        toolbar.setLogo(R.drawable.ic_launcher);
        // Title
        toolbar.setTitle("TabLayout");
        // Sub Title
        toolbar.setSubtitle("only a test");
        //Navigation Icon
//        toolbar.setNavigationIcon(R.drawable.ic_launcher);//不设置,默认是返回箭头
        setSupportActionBar(toolbar);
        
        //需要将setSupportActionBar(toolbar)放在setNavigationOnClickListener()之前设置才会响应click event
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
        
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        
		tabLayout = (TabLayout) findViewById(R.id.tabLayout);
		tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
		tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
		tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
		tabLayout.addTab(tabLayout.newTab().setText("Tab 4"));
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
	}

}


<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity" >

    <!-- AppBarLayout目前必须是第一个嵌套在CoordinatorLayout里面的子view -->
    <!-- AppBarLayout里面定义的view只要设置了app:layout_scrollFlags属性,就可以在RecyclerView滚动事件发生的时候被触发: -->
    <!-- app:layout_scrollFlags属性里面必须至少启用scroll这个flag,这样这个view才会滚动出屏幕,否则它将一直固定在顶部。 -->
    <!--
	可以使用的其他flag有:
		enterAlways: 一旦向上滚动这个view就可见。
		enterAlwaysCollapsed: 顾名思义,这个flag定义的是何时进入(已经消失之后何时再次显示)。假设你定义了一个最小高度(minHeight)同时enterAlways也定义了,那么view将在到达这个最小高度的时候开始显示,并且从这个时候开始慢慢展开,当滚动到顶部的时候展开完。
		exitUntilCollapsed: 同样顾名思义,这个flag时定义何时退出,当你定义了一个minHeight,这个view将在滚动到达这个最小高度的时候消失。
    -->
    <!-- 记住,要把带有scroll flag的view放在前面,这样收回的view才能让正常退出,而固定的view继续留在顶部。 -->

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"
            app:titleTextAppearance="@style/TextAppearance.AppCompat.Headline" />

        <!-- 如果想要 TabLayout从屏幕上消失,只需要给 TabLayout属性app:layout_scrollFlags="scroll|enterAlways" -->
        <!-- 如果你屏幕上显示只有少数 tab 的时候,可以设置tabMode="fixed",若很多需要拖动,则设置tabMode="scroll" -->
        <!-- 如果 tabMode 设置成 scrollable 的,则tabGravity属性将会被忽略 -->

        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabGravity="fill"
            app:tabMode="fixed"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp" >

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Username" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp" >

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Password" />
            </android.support.design.widget.TextInputLayout>

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="test" />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>


Test.rar (4.4 MB)

  • 描述: android5.1.1编译,需要v7-appcompat,design等扩展包
  • 下载次数: 0

标签:控件,setDuration,搭配,pop,ObjectAnimator,Design,android,main,view
From: https://blog.51cto.com/u_5454003/6186232

相关文章

  • ant-design 表单form label不换行
    <a-form:model="rightData"labelAlign="left"><a-form-itemlabel="标识名"><a-inputv-model:value="rightData.name":placeholder="input"/></a-form-item></a-form>......
  • electron+antdesignpro+react
    如果你想在Electron应用中使用AntDesignPro和React框架,可以按照以下步骤进行:创建一个基于React的AntDesignPro项目。将该项目作为渲染进程代码集成到Electron中。根据需要添加Electron的主进程代码。在第二步中,有两种方法将React和AntDesignPro项目......
  • 全面的VCL界面控件DevExpress VCL v22.2.5全新发布
    DevExpressVCL Controls是Devexpress公司旗下最老牌的用户界面套包,所包含的控件有:数据录入、图表、数据分析、导航、布局等。该控件能帮助您创建优异的用户体验,提供高影响力的业务解决方案,并利用您现有的VCL技能为未来构建下一代应用程序。DevExpressVCLv22.2.5正式版下载更......
  • CNC工艺全铝外壳5G模组搭配R4S使用演示 RM500U FM650
    关键词:CNC工艺  USB3.0  typeC  全铝外壳  R4S  RK3399FM650  RM500U  5G  LTE  OpenWrt Mcuzone 野芯科技概述:CNC工艺全铝外壳5G模组在R4S上配置使用演示硬件平台:CNC工艺全铝外壳5G模组  R4S软件平台:OpenWrt系统镜像文件:FriendlyWrt_20201209_NanoPi-R......
  • 界面控件DevExpress WPF的甘特图组件,可轻松集成项目管理功能!
    DevExpressWPF Gantt(甘特图)控件允许开发者在任何WPF桌面应用程序中快速集成项目计划和任务调度功能。DevExpressWPF拥有120+个控件和库,将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpressWPF能创建有着强大互动功能的XAML基础应用程序,这些应用程序专注......
  • Lighting System Design uva11400
    设计一个照明系统,一共有n(n<=1000)种灯泡可供选择,不同种类的灯泡必须用不同的电源,同一种灯泡则可以用一个,输入为一个n,以下n行,每行四个数值,代表电压V,电源费用K,每个灯泡费用C,所需灯泡数量L。n=0为结束标志。为了省钱,你可以把一些灯泡换成电压更高的以节省电源的钱,但不能换成更低的,......
  • Toast 控件定位
    Toast:一种消息框类型,永远不会获得焦点,无法被点击Toast显示的时间有限,Toast会根据用户设置的显示时间后自动消失是系统级别的控件,属于系统settingsappium使用的是uiautomator底层来抓取toast,再把toast放到控件树内,但是它本身不属于空间需要使用,automationName:uiautom......
  • Android 启用 Material Design 3(Material You) 小白教程
    介绍md3的效果:原本是红色壁纸对应的红色App主题,在改成绿色壁纸之后,App主题也相应的变成绿色了。这个效果主要是使用了MaterialYou中的动态颜色功能。官方文档https://m3.material.io具体每个组件的代码示例,在github上:https://github.com/material-components/materia......
  • ant-design-vue日历面板 a-calendar 属性自定义设置
    通过自定义属性设置,实现一个周末与工作日的不同颜色设置效果图: 使用的属性:自定义头部设置headerRender自定义日期显示dateFullCellRender代码:<template><divclass="box"><h3>1.自定义头部;2.自定义日期显示,工作日显示,周末显示</h3><a-c......
  • cxLookAndFeelController1控件换肤(08)
    cxLookAndFeelController1控件,只是对设计窗口的控件进行换肤,不对Form标题栏进行换肤,且在设计时,即可立即看到效果。 ......