動態設定UI

2021-08-28 10:08:48 字數 1896 閱讀 1884

/**

* 設定textview文字顏色

* @param textview 需要改變顏色的view

* @param normal 正常情況下,顯示的顏色

* @param selected 選擇時,顯示的顏色

*/public static void setselectorcolor(textview textview,int normal,int selected);

int states =new int[3];

states[0] =new int ;

states[1] =new int ;

states[2] =new int {};

colorstatelist colorstatelist =new colorstatelist(states,colors);

textview.settextcolor(colorstatelist);

}

textview mwifireconnectimage;

drawable drawable = null;

if (themes.equals("bluesky"))else

drawable.setbounds(0, 0, drawable.getminimumwidth(), drawable.getminimumheight());

mwifireconnectimage.setcompounddrawables(null, drawable, null, null);

textview mwifireconnectimage;

int colorint = color.parsecolor("#ffffff");

int int2rgb = colorutil.int2rgb(colorint);

mwifireconnectimage.settextcolor(color.rgb(int2rgb[0], int2rgb[1], int2rgb[2]));

/**

* 動態改變seekbar的progressdrawable

* @param seekbar

* @param color

*/public static void changeprogressdrawable(seekbar seekbar, int color)

}seekbar.setprogressdrawable(new layerdrawable(drawables));

seekbar.invalidate();

}

/**

* 動態改變shape的顏色

* @param imageview

* @param color

*/public static void changeshapecolor(imageview imageview, int color)

/**

* 設定textview圖示

* @param textview

* @paramd rawablenormal常態時的

* @paramd rawableselect選中時的

*/public static void setselectordrawable(textview textview, drawable drawablenormal, drawable drawableselect),drawableselect);

drawable.addstate(new int,drawablenormal);

textview.setbackgrounddrawable(drawable);

}

VS Qt QUiLoader動態載入 ui檔案

quiloader uiloader qfile file qtdemo qtdemo.ui file.open qfile readonly qwidget ui uiloader.load file file.close qvboxlayout layout new qvboxlayout la...

動態更新UI之元件更新

專案中使用到了仿iphone那樣的城市分組列表,網上找到了乙個demo但是問題來了,他的資料是直接放在裡面的,而我的需求是動態獲取資料,再更新ui import android.content.context import android.graphics.canvas import android...

UI控制項圓角形狀設定

textfield.layer.cornerradius 5.0 需要匯入框架quartzcore.framework,並且在當前類中引用 import textfield.borderstyle uitextborderstylerounded rect 這樣就明顯好看多了,設定成這個樣式後,四周...