Menu with customized layout

Asked

Viewed 168 times

0

I need to create custom menu so it stays that way: layout do menu

so I created a res/layout/layout_menuitem.xml . xml to serve as my app’s menu.


<TextView android:id="@+id/text_minha_conta" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/minha_conta" android:background="@color/white" android:textSize="20sp" android:textColor="@color/black" android:padding="10dp" /> <TextView android:id="@+id/text_meus_pedidos" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/meus_pedidos" android:textSize="20sp" android:textColor="@color/black" android:padding="10dp" /> <TextView android:id="@+id/text_notificacoes" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/notificacoes" android:textSize="20sp" android:textColor="@color/black" android:padding="10dp" /> <TextView android:id="@+id/text_fale_conosco" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/fale_conosco" android:textSize="20sp" android:textColor="@color/black" android:padding="10dp" /> <TextView android:id="@+id/text_politica" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/politica" android:textSize="20sp" android:textColor="@color/black" android:padding="10dp" /> <TextView android:id="@+id/text_sobre" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/sobre" android:textSize="20sp" android:textColor="@color/black" android:padding="10dp" /> <TextView android:id="@+id/text_sair" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/sair" android:textSize="20sp" android:textColor="@color/apptheme_color" android:padding="10dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5" android:src="@drawable/facebook_icon_small"/> <ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5" android:src="@drawable/email_icon_small"/> </LinearLayout>

But I can’t do the same menu layout, and I can’t do layout_menuitem as an application menu.

  • Your menu file should be in the folder res/menu/, also, put the Textviews within a layout ( e.g.: Linearlayout), do not let them "loose".

  • I think I should use these functions according to the best practices recommendations of Android. IE, the menu button in the left corner.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.