国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android設置PreferenceCategory背景顏色的方法

2020-04-11 11:32:53
字體:
來源:轉載
供稿:網友

本文實例講述了Android設置PreferenceCategory背景顏色的方法。分享給大家供大家參考。具體分析如下:

大家可能遇到,PreferenceCategory默認是黑色背景,如何我們更換了PreferenceScreen的背景,那么這種分隔欄看上去很丑,那么怎么更改背景呢?我們可以通過自定義VIEW來實現。

代碼如下:

public class MyPreferenceCategory extends PreferenceCategory { public MyPreferenceCategory(Context context, AttributeSet attrs) {  super(context, attrs); } @Override protected void onBindView(View view) {  super.onBindView(view);  view.setBackgroundColor(Color.parseColor("#b0000000"));  if (view instanceof TextView) {   TextView tv = (TextView) view;   tv.setTextSize(16);   tv.setTextColor(Color.BLACK);  } }}

在xml調用時(自定義用法。。。你懂的):

<com.blogchen.myview.MyPreferenceCategory android:title="其他" >  <PreferenceScreen   android:key="blog_"   android:summary="作者博客地址"   android:title="訪問博客" >   <intent    android:action="android.intent.action.VIEW"    android:data="http://www.survivalescaperooms.com" />  </PreferenceScreen></com.blogchen.myview.MyPreferenceCategory>

希望本文所述對大家的Android程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丰都县| 宁津县| 信阳市| 铅山县| 高安市| 河津市| 通城县| 马尔康县| 平度市| 绥滨县| 博客| 达拉特旗| 巴彦淖尔市| 松溪县| 福鼎市| 景洪市| 盈江县| 新宾| 阳东县| 连州市| 革吉县| 志丹县| 青阳县| 工布江达县| 同仁县| 酒泉市| 张家川| 滨州市| 岳池县| 抚松县| 怀安县| 叙永县| 沧州市| 延长县| 夹江县| 西安市| 诸城市| 周至县| 清水县| 岱山县| 个旧市|