2
我使用支持包中的新工具欄。如何更改支持工具欄菜單項的onPress行爲?
在Android 5.0上,我獲得了很好的觸摸效果。 在較低版本中,我也得到了按下狀態,但它非常微妙。
如何更改工具欄菜單項的按下狀態?
我使用支持包中的新工具欄。如何更改支持工具欄菜單項的onPress行爲?
在Android 5.0上,我獲得了很好的觸摸效果。 在較低版本中,我也得到了按下狀態,但它非常微妙。
如何更改工具欄菜單項的按下狀態?
你可以改變你的風格按下狀態的影響
<item name="selectableItemBackground">
@drawable/selectable_item_background_selector
</item>
<item name="android:selectableItemBackground">
@drawable/selectable_item_background_selector
</item>
在Android 5.0可以覆蓋風格「風格-V21」,並設置一個波動繪製(在繪製-V21):
<item name="android:selectableItemBackgroundBorderless">
@drawable/ripple_selector
</item>
要更改按下狀態風格只爲工具欄,你可以設置自定義主題
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:theme="@style/ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"/>
放'<項目名稱=「訴權nBarItemBackground「> @ drawable/some_selector'裏面你的風格/主題通常是'android \ support \ v7 \ appcompat \ res \ drawable \ abc_item_background_holo_(light/dark).xml' – Selvin 2014-11-25 13:57:50