Android樣式和主題之選擇器的實(shí)例講解
Android學(xué)習(xí)筆記之樣式和主題之選擇器
(1)布局文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="189dp" android:layout_marginLeft="55dp" android:textColor="@color/button_selector" android:text="測(cè)試顏色列表狀態(tài)" /> </RelativeLayout>
需要在按鈕里邊使用:android:textColor="@color/button_selector"
(2)需要在res目錄下創(chuàng)建一個(gè)color文件夾
button-selector文件內(nèi)容如下:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:color="#ffff0000"/> <item android:state_focused="true" android:color="#ff0000ff"/> <item android:color="#ff000000"/> </selector>
其他文件不做修改,默認(rèn)的就可以
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接
- Android單項(xiàng)綁定MVVM項(xiàng)目模板的方法
- Android開發(fā)實(shí)現(xiàn)的圖片瀏覽功能示例【放大圖片】
- Android開發(fā)之ListView的簡(jiǎn)單用法及定制ListView界面操作示例
- Android實(shí)現(xiàn)自定義滑動(dòng)刻度尺方法示例
- Android文字基線Baseline算法的使用講解
- Android開發(fā)實(shí)現(xiàn)ListView和adapter配合顯示圖片和文字列表功能示例
- Android使用google breakpad捕獲分析native cash
- Android應(yīng)用動(dòng)態(tài)修改主題的方法示例
- Android點(diǎn)擊Button實(shí)現(xiàn)切換點(diǎn)擊圖片效果的示例
- Android在ubuntu上過濾多條關(guān)鍵字日志
相關(guān)文章
Android使用動(dòng)畫動(dòng)態(tài)添加商品進(jìn)購(gòu)物車
這篇文章主要為大家詳細(xì)介紹了Android使用動(dòng)畫動(dòng)態(tài)添加商品進(jìn)購(gòu)物車,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-06-06Android 基礎(chǔ)入門教程——開發(fā)環(huán)境搭建
這篇文章主要介紹了Android 如何搭建開發(fā)環(huán)境,文中講解非常細(xì)致,幫助大家開始學(xué)習(xí)Android,想要學(xué)習(xí)Android的朋友可以了解下2020-06-06Android中Listview點(diǎn)贊功能的實(shí)現(xiàn)
最近一段時(shí)間在研究android方面的知識(shí),利用listview實(shí)現(xiàn)點(diǎn)贊功能,下面小編通過本文給大家介紹下基本思路,需要的朋友可以參考下2016-11-11使用OkHttp包在Android中進(jìn)行HTTP頭處理的教程
HTTP頭部處理是HTTP網(wǎng)絡(luò)編程中的基本操作,安卓中使用OkHttp包(github.com/square/okhttp)進(jìn)行相關(guān)操作當(dāng)然也是得心應(yīng)手,這里我們就來看一下使用OkHttp包在Android中進(jìn)行HTTP頭處理的教程2016-07-07Android有效獲取狀態(tài)欄(StatusBar)高度的方法
這篇文章主要介紹了Android有效獲取狀態(tài)欄(StatusBar)高度的方法,涉及Android針對(duì)狀態(tài)欄(StatusBar)屬性操作的相關(guān)技巧,需要的朋友可以參考下2016-08-08Android 如何實(shí)現(xiàn)exclude aar包中的某個(gè)jar包
這篇文章主要介紹了Android 如何實(shí)現(xiàn)exclude aar包中的某個(gè)jar包,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-03-03Android自定義ListView實(shí)現(xiàn)仿QQ可拖拽列表功能
這篇文章主要介紹了Android自定義ListView實(shí)現(xiàn)仿QQ可拖拽列表功能,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-08-08