Reputation: 311
The layout of my MainActivity on my phone appears very differently than the layout I see on the code editor. Images are included. I am using a TabbedView. However, the problem still exists on any layout I choose (empty/tabbed).
What can I do to solve this problem?
I am concerned about the text "Hello world" in the middle, not in the top left corner. I follow this tutorial and in the tutorial it is correctly positioned.
Upvotes: 3
Views: 1442
Reputation: 75629
It works as expected, because section_label
TextView width is wrap_content
it changes, depending on what text it displays. And the 2nd TextViews position depends on it, so it changes too. You should be able to verify this by setting various length texts in your layout editor.
For what you want to achieve, RelativeLayout
is not the best choice and you may want to use i.e. LinearLayout
instead, with its orientation set to vertical
and layout_gravity
of second TextView
set to right
Upvotes: 2
Reputation: 214
This is happen because you are using the RelativeLayout in the relativelayout we can arrage our views in custom position wise by the help of give the android:id=@+id/some_id like this if you want your second view is shown just below the first view then give them the property android:layout_below="@id/view1" in your second view Please read all the documentation of RelativeLayout form this link https://developer.android.com/guide/topics/ui/layout/relative.html
Upvotes: 1