我想知道是否可以更改样式,文本,textColor,一个或多个按钮或图像按钮按下按钮,聚焦,仅使用XML选择器项目和< strong> axml 布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:foo="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="20dp"
android:minWidth="25dp"
android:minHeight="25dp"
android:gravity="center">
<RelativeLayout
android:id="@+id/innerlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:minWidth="25dp"
android:minHeight="25dp"
android:gravity="start">
<ImageButton
android:id="@+id/searchic"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:scaleType="fitXY"
android:alpha="1"
android:background="@drawable/searchbut"
android:clickable="true" />
<Button
android:text="SEARCH"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="@+id/searchlb"
android:layout_toRightOf="@+id/searchic"
android:layout_marginLeft="10dp"
android:background="#00ffffff"
android:textColor="@drawable/menuwordcolor"
android:clickable="true"
android:alpha="1"
android:textSize="25dp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/playlistic"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:scaleType="fitXY"
android:layout_below="@+id/searchic"
android:background="@drawable/playlistbut"
android:clickable="true"
android:alpha="1" />
<Button
android:text="PLAYLIST"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="@+id/playlistlb"
android:layout_toRightOf="@+id/playlistic"
android:layout_below="@+id/searchic"
android:layout_marginLeft="10dp"
android:background="#00ffffff"
android:textColor="@drawable/menuwordcolor"
android:clickable="true"
android:alpha="1"
android:textSize="25dp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/favouritesic"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:scaleType="fitXY"
android:layout_below="@+id/playlistic"
android:background="@drawable/favouritesbut"
android:clickable="true"
android:alpha="1" />
<Button
android:text="FAVOURITES"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="@+id/favouriteslb"
android:layout_toRightOf="@+id/favouritesic"
android:layout_below="@+id/playlistic"
android:layout_marginLeft="10dp"
android:background="#00ffffff"
android:textColor="@drawable/menuwordcolor"
android:clickable="true"
android:alpha="1"
android:textSize="25dp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/actionsic"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:scaleType="fitXY"
android:layout_below="@+id/favouritesic"
android:background="@drawable/actionsbut"
android:clickable="true"
android:alpha="1" />
<Button
android:text="ACTIONS"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="@+id/actionslb"
android:layout_toRightOf="@+id/actionsic"
android:layout_below="@+id/favouritesic"
android:layout_marginLeft="10dp"
android:textColor="@drawable/menuwordcolor"
android:clickable="true"
android:background="#00ffffff"
android:alpha="1"
android:textStyle="bold"
android:textSize="25dp"
foo:customFont="Fonts/helvetica-neue-bold.ttf" />
</RelativeLayout>
</RelativeLayout>
这里是名为menuwordcolor的xml文件...这只是xml选择器的标准示例
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="#30abd5" />
<item android:state_pressed="false" android:color="#ffffff" />
<item android:state_enabled="true" android:color="#ffffff" />
</selector>