我試圖在XML文件中使用圖形界面和android:layout_alignParentLeft來移動按鈕,無論如何它不起作用。我的Android Studio版本是2.2.3。你有過這個問題嗎?我無法移動框架佈局中的按鈕
1
A
回答
5
你需要RelativeLayout或其他simlilar佈局父容器,因爲FrameLayout只畫一個視圖中對另一再加上你應該檢查屬性部分看,你可以適用於你的佈局attibute
屬性。
To read further about ViewGroups and it's sub-types with their behaviours
+1
明白了,作品...! –
+1
@MMManuel我很高興我能幫忙,快樂編碼:) –
1
如果你不得不使用的FrameLayout(例如,在工具欄或左右),你只有一個元素(或少量)與(按鈕)來操作,您可以使用android:layout_gravity=""
屬性中的FrameLayout對齊元素。
如果你在你的佈局幾個要素,你可以:1)變化的FrameLayout到的RelativeLayout或2)包裝所有物品進入相對佈局和設置參數,以match_parent
<FrameLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"/>
</RelativeLayout>
</FrameLayout>
相關問題
- 1. 移動佈局中的基礎按鈕
- 2. 框架佈局左側的按鈕?
- 3. 默認和移動佈局Zend框架
- 4. 旋轉框架佈局其中包含動態按鈕
- 5. 我無法移動按鈕(HTML&CSS)
- 6. Tkinter - 無法將按鈕放在中間帆布/框架
- 7. 更改佈局/框架響應按鈕按
- 8. 的框架佈局
- 9. Android按鈕浮動佈局
- 10. 動態按鈕Android佈局
- 11. 動態按鈕佈局android
- 12. 在無脂框架中加載佈局
- 13. 無法從JDialog禁用框架按鈕
- 14. 對話框佈局中缺少按鈕
- 15. 無法在佈局列表底部顯示我的按鈕
- 16. 我無法獲得佈局底部的按鈕
- 17. 微調框無法在框架佈局中選擇
- 18. 如何將圓圈移動到「WEST」邊框佈局框架?
- 19. 更改按鈕單擊框架佈局的內容
- 20. 設置在Android上按鈕的文本使用框架佈局
- 21. 爲什麼我無法在佈局爲空時顯示框架?
- 22. Python GUI框架和按鈕佈局,如何將框架和按鈕添加到正確的位置?
- 23. 框架佈局內的線性佈局
- 24. 框架無法移動在actionscript3.0
- 25. jquery移動按鈕休息和進一步中斷佈局
- 26. Zend框架佈局
- 27. 佈局Zend框架
- 28. Zend框架佈局
- 29. iOS「框架佈局」
- 30. 將多個按鈕添加到框架佈局(android)
請出示你的XML代碼.. –