如何在 android 操作菜单中显示带文本的图标列表,如图像
How to show list of icon with text in android action menu like image
我想在点击操作按钮(3 ... 图标)时显示一个选项弹出窗口,如图片所示。
我尝试通过选项菜单来完成,但图标没有出现。请建议我如何添加图标。
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="ui.dealroomcontent.DealRoomContentActivity">
<item
android:id="@+id/action_view_details"
android:title="View room details"
android:orderInCategory="100"
android:icon="@drawable/ic_dealroom_details_normal"
app:showAsAction="never" />
<item
android:id="@+id/action_add_file"
android:title="@string/action_create_file"
android:orderInCategory="100"
android:icon="@drawable/ic_dealroom_createfolder_normal"
app:showAsAction="never" />
<item
android:id="@+id/action_add_folder"
android:title="@string/action_create_folder"
android:icon="@drawable/ic_dealroom_createfile_normal"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_upload_from_camera"
android:title="@string/action_upload_from_camera"
android:icon="@drawable/ic_dealroom_uploadcamera_normal"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_upload_from_gallery"
android:title="@string/action_upload_from_gallery"
android:icon="@drawable/ic_dealroom_uploadgallery_normal"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_upload_from_local"
android:title="@string/action_upload_from_local"
android:orderInCategory="100"
android:icon="@drawable/ic_dealroom_upload_normal"
app:showAsAction="never" />
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_more"
android:icon="@drawable/ic_more_white"
android:title="@string/action_more"
android:orderInCategory="100"
app:showAsAction="always">
<menu>
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_settings_black"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
<item ... />
</menu>
</item>
</menu>
ic_more_white是3的图标...
希望对您有所帮助。
我想在点击操作按钮(3 ... 图标)时显示一个选项弹出窗口,如图片所示。
我尝试通过选项菜单来完成,但图标没有出现。请建议我如何添加图标。
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="ui.dealroomcontent.DealRoomContentActivity">
<item
android:id="@+id/action_view_details"
android:title="View room details"
android:orderInCategory="100"
android:icon="@drawable/ic_dealroom_details_normal"
app:showAsAction="never" />
<item
android:id="@+id/action_add_file"
android:title="@string/action_create_file"
android:orderInCategory="100"
android:icon="@drawable/ic_dealroom_createfolder_normal"
app:showAsAction="never" />
<item
android:id="@+id/action_add_folder"
android:title="@string/action_create_folder"
android:icon="@drawable/ic_dealroom_createfile_normal"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_upload_from_camera"
android:title="@string/action_upload_from_camera"
android:icon="@drawable/ic_dealroom_uploadcamera_normal"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_upload_from_gallery"
android:title="@string/action_upload_from_gallery"
android:icon="@drawable/ic_dealroom_uploadgallery_normal"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_upload_from_local"
android:title="@string/action_upload_from_local"
android:orderInCategory="100"
android:icon="@drawable/ic_dealroom_upload_normal"
app:showAsAction="never" />
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_more"
android:icon="@drawable/ic_more_white"
android:title="@string/action_more"
android:orderInCategory="100"
app:showAsAction="always">
<menu>
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_settings_black"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
<item ... />
</menu>
</item>
</menu>
ic_more_white是3的图标... 希望对您有所帮助。