Android UI使用總結

2021-09-02 08:36:15 字數 811 閱讀 5521

1. gridview 去掉press的藍色背景

mgridview.setselector(new colordrawable(color.transparent));

2. fragmenttabhost去掉分隔條

mtabhost.gettabwidget().setdividerdrawable(r.color.transparent);

3. 隱藏輸入法:

((inputmethodmanager) getsystemservice(input_method_service)).hidesoftinputfromwindow(this

.getcurrentfocus().getwindowtoken(), inputmethodmanager.hide_not_always);

4. android中字型加粗

1)在xml檔案中使用android:textstyle=」bold」

2)但是不能將中文設定成粗體,將中文設定成粗體的方法是:

textview tv = (textview)findviewbyid(r.id.textview01);

textpaint tp = tv.getpaint();

tp.setfakeboldtext(true);

5. scrollview中元素不能佔滿scrollview

android:fillviewport="true"

6. scrollview禁用滾動

scrview.setontouchlistener(new view.ontouchlistener()

});

android UI元件總結

android的元件基本都按如下方法生成 1 生成乙個元件物件 通過xml檔案或在 中生成 2 對元件進行設定 3 新增事件 view view中的settag onbect 表示給view新增乙個格外的資料,以後可以用gettag 將這個資料取出來。可以用在多個button新增乙個 每個butto...

android UI元件總結

android的元件基本都按如下方法生成 1 生成乙個元件物件 通過xml檔案或在 中生成 2 對元件進行設定 3 新增事件 view view中的settag onbect 表示給view新增乙個格外的資料,以後可以用gettag 將這個資料取出來。2 設定listview物件的各個屬性。主要是a...

Android UI元件使用

android ui元件使用 textview 文字檢視 id指定id width指定寬度 height指定高度 text指定文字內容 textcolo指定文字顏色 textsize指定字型大小 radiogroup 單選擇框組 radiobutton 單選擇框 部分屬性 getmax 返回這個進度...