我正在尝试使用3个按钮与中心对齐进行线性布局。Android-按钮的一部分从布局中删除
但是,在设置了一些重量并将空间置于其间之后,最后一个按钮的布局中有1/4被删除,不可见并且不可点击。其他部分虽然工作得很好。
对不起它的一个新的帐户,所以我不能嵌入的截图,而不是请点击以下链接:
,并请另见下文
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum="4">
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<!--Nesting Structured Layout-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:weightSum="10"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_weight="2">
<!--This is for the Start button-->
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:text="@string/starting_button"/>
<!--Spacing-->
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<!--This is for the Message button-->
<Button
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="@string/liitle_message_button"/>
<!--Spacing-->
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<!--This is for the Settings button-->
<Button
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="@string/settings_button"/>
</LinearLayout>
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
什么码导致问题的代码问题?还有其他更好的方法来达到相同的结果吗?
P.S对不起,作为一个非英语母语的用户,我很抱歉,它可能有大量的语法错误或以不礼貌的方式提问,请让我知道你是否感到冒犯。
我既然对不起我迟到的答复 – Noobnewbier
我是新来的stackoverflow,我吨希望我会有电子邮件每次我有一个答案......但似乎它不是它的工作方式TAT – Noobnewbier
没问题,你的问题解决了吗? – Avin