java - How to create a menu/tab in Android application? -
i'm new java , android studio, i'm learning how make simple app buttons. application has bunch of buttons though, thought nicer if split buttons 2 windows/tabs using menu of sort. right now, xml file looks this:
<relative layout.... <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 1" android:id="@+id/opt1" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 2" android:id="@+id/opt2" android:layout_below="@+id/opt2" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 3" android:id="@+id/opt3" android:layout_alignparentright="true" android:layout_alignparentend="true" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 4" android:id="@+id/opt4" android:layout_alignbottom="@+id/opt2" android:layout_alignparentright="true" android:layout_alignparentend="true" /> <edittext android:layout_width="300dp" android:layout_height="80dp" android:text="say something..." android:id="@+id/text" android:layout_below="@+id/opt2" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_margintop="10dp" android:editable="true" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 5" android:id="@+id/opt5" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 6" android:id="@+id/opt6" android:layout_alignparentbottom="true" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 7" android:id="@+id/opt7" android:enabled="false" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="option 8" android:id="@+id/opt8" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:enabled="false" /> </relativelayout>
in main activity class, have action listeners these buttons in protected void oncreate(bundle savedinstancestate) method. now, layout cluttered , want move buttons 5-8 , edittext object tab or window of sort, don't know how that. there simple way go this? appreciated! thank you
Comments
Post a Comment