我的Android應用程序有兩個並排長度相同的圖像按鈕。他們填滿了一條線。 我打開手機,但imagebuttons沒有填滿線。 即使手機旋轉如何正確顯示? 感謝旋轉問題
Q
旋轉問題
0
A
回答
0
把這兩樣,如果它按預期工作中的TableRow &檢查按鈕後旋轉。
0
如果您使用的是水平佈局,請確保將寬度設置爲「fill_parent」,並且重量正確調整。
您還可以在onCreate中手動設置圖像按鈕的寬度。
1
使用線性佈局的weight屬性。將這兩個按鈕都放在內襯布局中,爲這兩個按鈕指定layout_width = odp和weight = 1。權重元素允許您指定每個元素將採用的寬度的比率。下面是一個簡單
<LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_width="fill_parent">
<Button android:text="Button" android:id="@+id/button1"
android:layout_height="wrap_content" android:layout_width="0dp"
android:layout_weight="1">
</Button>
<Button android:text="Button" android:id="@+id/button2"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="0dp">
</Button>
</LinearLayout>
編輯:樣本是一個按鈕,但你可以使用它的圖像按鈕太
相關問題
- 1. 旋轉問題
- 2. OpenGL旋轉問題
- 3. OpenGL旋轉問題
- 4. ios6旋轉問題
- 5. Java旋轉問題
- 6. IOS6旋轉問題
- 7. UITableView旋轉問題
- 8. 旋轉問題Android
- 9. UIViewController旋轉問題
- 10. Android旋轉問題
- 11. CSS3旋轉問題
- 12. c#旋轉問題
- 13. SearchBar旋轉問題
- 14. 旋轉UIImage問題
- 15. UIScrollView旋轉問題
- 16. iPhone旋轉問題
- 17. UIView旋轉問題
- 18. UiViewController旋轉問題
- 19. MPMoviePlayerViewController旋轉問題
- 20. 軸旋轉問題
- 21. CSS3旋轉問題
- 22. UIModalPresentationFullScreen旋轉問題
- 23. pygame旋轉問題
- 24. 循環旋轉:左旋轉問題
- 25. CSS3轉換旋轉問題
- 26. C#旋轉(轉換)問題
- 27. UIWebview旋轉+轉換問題
- 28. Android旋轉問題與onConfigurationChanged
- 29. ios9 UICollectionView問題,旋轉後
- 30. Xcode iPad旋轉問題
非常感謝您拉維,示例代碼工作。 – realuser
我並不意味着粗魯無禮,但是當答案有用/正確時,您需要接受它並將其提升。 –