2
我有一個TabHost項目,我希望它們只在點擊時突出顯示。列表視圖項目在點擊時突出顯示(不需要)
我收到了它,我的列表視圖本身,而是對TabHost什麼也沒有改變(我認爲這不應該的問題。)
<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"
tools:context="at.htl3r.appmosphere.MainActivity$PlaceholderFragment" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
<ListView
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
<ListView
android:id="@+id/tab3"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
<ListView
android:id="@+id/tab4"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</FrameLayout>
</LinearLayout>
</TabHost>
</RelativeLayout>
我看了一些帖子如何禁用它,但I don't want to disable it complete因爲我會處理點擊動作
我嘗試添加choiceMode="none"
和selector
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/darkgreen_light" android:state_pressed="true"/>
<item android:drawable="@android:color/transparent" android:state_activated="true"/>
<item android:drawable="@android:color/transparent" android:state_checked="true"/>
<item android:drawable="@android:color/transparent" android:state_selected="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>
UPDATE
更好的選擇:ViewPagerIndicator
我只想處理onclicks而不是選擇;不會改變任何東西... 仍然選擇被點擊的項目.. – rala 2014-12-19 10:33:11
請參閱我的更新 – rekaszeru 2014-12-19 10:41:52
我的意思是它不應該是恆定的,如果我點擊它應該只在印刷過程中突出顯示,但不能 – rala 2014-12-19 10:51:49