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
- Create a menu xml in menu folder
- Inflate the menu in onCreateOptionsMenu of your activity
- 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.
精彩评论