@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.tv_transition).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TransitionDrawable drawable = (TransitionDrawable) v.getBackground();
drawable.startTransition(3000);
}
});
ScaleDrawable scaleDrawable = (ScaleDrawable) findViewById(R.id.v_scale).getBackground();
scaleDrawable.setLevel(10); //lever默认为0,无法显示。level范围为0~10000。level越大,显示的越大
ClipDrawable clipDrawable = (ClipDrawable) findViewById(R.id.v_clip).getBackground();
clipDrawable.setLevel(5000);
View vCustom = findViewById(R.id.v_custom);
CustomDrawable customDrawable = new CustomDrawable(getResources().getColor(R.color.colorAccent));
vCustom.setBackground(customDrawable);
}
MainActivity.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:ArtOfAndroid
作者:
评论列表
文章目录