Translations:Android Training/Building a Simple User Interface/5/en
Create a Linear Layout[edit source]
- In Android Studio, from the
res/layout
directory, open theactivity_my.xml
file.- The BlankActivity template you chose when you created this project includes the
activity_my.xml
file with a RelativeLayout root view and aTextView
child view.
- The BlankActivity template you chose when you created this project includes the
- In the Preview pane, click the Hide icon to close the Preview pane.
- In Android Studio, when you open a layout file, you’re first shown the Preview pane. Clicking elements in this pane opens the WYSIWYG tools in the Design pane. For this lesson, you’re going to work directly with the XML.
- Delete the
<TextView>
element. - Change the
<RelativeLayout>
element to<LinearLayout>
. - Add the
android:orientation
attribute and set it to"horizontal"
. - Remove the
android:padding
attributes and thetools:context
attribute.