編輯:關於Android編程
public void setBackgroundColor(@ColorInt int color) {
if (mBackground instanceof ColorDrawable) {
((ColorDrawable) mBackground.mutate()).setColor(color);
computeOpaqueFlags();
mBackgroundResource = 0;
} else {
setBackground(new ColorDrawable(color));
}
}
GradientDrawable的構造函數:public GradientDrawable(GradientDrawable.Orientationorientation, int[] colors)
clip元素中只有android:drawable、android:clipOrientation和android:gravity三個屬性,其中android:drawable為需要裁剪的原始圖片,android:clipOrientation為裁剪的方向,可以按照垂直(vertical)或者水平(horizontal)方向進行裁剪,android:gravity為指定從哪裡開始裁剪,這個可以通過或操作設置多個屬性。
-
-
-
-
-
-
LevelListDrawable對應於
注意這裡要用src,background是不起作用的。 需要變換圖片時,調用這個方法iView.setImageLevel(1);
一個TransitionDrawable是一個特殊的Drawable對象,可以實現兩個drawable資源之間淡入淡出的效果。
節點下的每個startTransition()。向後,調用reverseTransition()。
res/drawable/filename.xmlTransitionDrawable的指針資源引用:In Java:R.drawable.filename@[package:]drawable/filename語法:
-
例子:XML文件保存為:res/drawable/transition.xml:
在layout文件中使用:
ImageButton button = (ImageButton) findViewById(R.id.button); TransitionDrawable drawable = (TransitionDrawable) button.getDrawable(); drawable.startTransition(500);
小米5、榮耀V8、魅族PRO6和一加手機3哪個好 參數對比評測
國產手機的集體高潮,卻使消費者變的“煩惱了”,因為消費者在購買手機時變得越來越猶豫糾結。以2499元這個價位的手機來說,單國產手機就
微信朋友圈怎麼轉發?微信朋友圈分享資源要轉發到我的朋友圈怎麼
微信朋友圈現在比較亂,一堆微商把裡面弄得烏煙瘴氣亂七八糟,但是有時候有些內容還是值得認可的,我們最好的支持方式就是轉發了,那麼微信朋友圈怎麼轉發?微信朋友圈
第十四章,通過Intent打開其他軟件(Android)
activity_main.xml MainActivity.java package com.example.demo0623;impo
深入透析Android事件分發機制
一、 Android分發機制概述: Android如此受歡迎,就在於其優秀的交互性,這其中,Android優秀的事件分發機制功不可沒。那麼,作為一個優秀的程序員,要想做