我有以下布局:
begin RelativeLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
TextView
begin LinearLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
4 - 6 radio buttons variable number
end LinearLayout
TextView
end RelativeLayout因此,当有六个单选按钮时,它显示得很好。当只有4个时,它们会移动到顶部,我希望它们居中。我没有找到LinearLayout本身的android:layout_alignParentCenter="true“或中间选项,所以它会转到屏幕的中心。单独地,单选按钮元素可变地组成4-6个元素。那么,我如何让这4个元素位于线性布局的中心,或者位于屏幕中央的线性布局。谢谢
发布于 2011-03-25 06:22:46
你试过在你的LinearLayout上设置android:layout_centerVertical="true"吗
您可能需要将LinearLayout设置为使用android:layout_height="wrap_content"才能正常工作。
https://stackoverflow.com/questions/5426208
复制相似问题