开发者

Center icons and spread them on multiple lines automatically

开发者 https://www.devze.com 2023-02-18 08:00 出处:网络
I want to make a launch bar in my appli开发者_开发技巧cation with a number of icons. Is there a way for the icons to be automatically distributed on multiple lines if a line is full?

I want to make a launch bar in my appli开发者_开发技巧cation with a number of icons.

Is there a way for the icons to be automatically distributed on multiple lines if a line is full?

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

With this code they overflow out of the screen. Any idea?


I think the term you are looking is Menu Options.

Link to assist you with creating menu http://developer.android.com/guide/topics/ui/menus.html

Fairly straightforward You need to

  1. Create a menu xml in menu folder
  2. Inflate the menu in onCreateOptionsMenu of your activity
  3. Control menu action (eg. open activity) in onOptionsItemSelected of your activity


We will not in the end implement such a menu, but rather display a much icons as we can and provide a "more" button if needed.

However if someone is looking for something similar in the future, this DashboardLayout would be a good starting point.

0

精彩评论

暂无评论...
验证码 换一张
取 消