1. 使用style+代码控制TextView的不同状态下的颜色(selected,pressed,normal)
<LinearLayout
android:id="@+id/linearLayout_tap1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="180"
android:background="@drawable/selector_lin_layout_left_tab"
android:gravity="center"
android:orientation="vertical" >
<ImageButton
android:id="@+id/img_btn_edit2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:clickable="false"
android:src="@drawable/selector_img_btn_left_tab1" />
<TextView
android:id="@+id/textView_edit2"
style="@style/textView_tap_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="移动" />
</LinearLayout>
<style name="textView_tap_left">
<item name="android:textColor">@color/color_text_left_tab</item>
<item name="android:textSize">20sp</item>
<item name="android:textStyle">bold</item>
</style>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="#ffff0000"/>
<item android:state_selected="true" android:color="#ff168fb9"/>
<item android:color="#6c6c6c"/>
</selector>
父控件linearLayout_tap1被点击时候,设置TextView为Selected状态
TextView textView_edit2 = (TextView) findViewById(R.id.textView_edit2);
textView_edit2.setSelected(true);