在我的布局中,这不会将按钮移动到屏幕的右侧。 我错过了什么? 该按钮位于线性布局内。 但是有它自己的相对布局。Android布局问题
0
A
回答
0
对于main.xml来说就像这样。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="right" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_alignParentRight="true"
android:text="Right Button"
</Button>
</RelativeLayout>
</LinearLayout>
干杯。
0
设置RelativeLayout的机器人:宽度为 “FILL_PARENT”,为的LinearLayout设置了android:layout_gravity属性设置为 “右”
1
试试这个,它为我工作。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:orientation="vertical"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
<Button
android:text="Button"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
</Button>
</LinearLayout>
</RelativeLayout>
相关问题
- 1. 布局问题。 Android
- 2. Android布局问题
- 3. Android布局问题
- 4. Android布局问题
- 5. Android布局问题
- 6. Android布局问题
- 7. Android布局问题
- 8. Android布局问题
- 9. Android布局问题
- 10. Android布局问题?
- 11. Android布局问题
- 12. Android布局问题
- 13. Android布局问题
- 14. Android布局问题
- 15. Android布局问题
- 16. Android相对布局布局问题
- 17. Android中的布局问题
- 18. Android相对布局问题
- 19. android xml布局问题
- 20. imageview的布局问题Android
- 21. Android中的布局问题
- 22. android中的布局问题
- 23. Android缩放(布局)问题
- 24. Android相对布局问题
- 25. 的Android XML布局问题
- 26. Android布局问题webview
- 27. EditText的Android布局问题?
- 28. android相对布局问题
- 29. Android布局Fill_Parent问题
- 30. Android的布局问题
你可以发布布局文件吗?什么是“这个? –
检查出这个链接........ http://www.tutorialforandroid.com/2009/01/relativelayout-in-android-xml.html – Uttam