Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 将图标居中并自动在多行上展开_Android_Android Layout - Fatal编程技术网

Android 将图标居中并自动在多行上展开

Android 将图标居中并自动在多行上展开,android,android-layout,Android,Android Layout,我想在我的应用程序中创建一个带有多个图标的启动栏 如果一行已满,是否有办法使图标自动分布在多行上 <LinearLayout android:id="@+id/MenuLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:gravity="center"> </L

我想在我的应用程序中创建一个带有多个图标的启动栏

如果一行已满,是否有办法使图标自动分布在多行上

<LinearLayout android:id="@+id/MenuLayout"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" android:gravity="center">
</LinearLayout>


有了这些代码,它们就会溢出屏幕。有什么想法吗?

我想你要找的术语是菜单选项

链接以帮助您创建菜单

相当直接 你需要

  • 在菜单文件夹中创建菜单xml
  • 在活动的OnCreateOptions菜单中为菜单充气
  • 在活动的OnOptions项Selected中控制菜单操作(例如打开活动)

  • 我们最终不会实现这样的菜单,而是尽可能多地显示图标,并在需要时提供“更多”按钮


    但是,如果将来有人想要类似的东西,这将是一个很好的起点。

    我所说的“启动栏”是指屏幕底部的一些图像按钮,可以访问我的应用程序的功能。Kinf与dashboard模式()类似,但只有几行。这不是我的意思,我想要的是在活动上显示一个图标栏,而不是在其顶部。但菜单选项中实现的行为正是我想要的——根据可用空间自动排列固定大小的项目。