我想在 FrameLayout 中逐个添加两个按钮,但它们应该相互接触。但是,我无法做到这一点。这是我的代码:
<FrameLayout
android:id="@+id/lytOptions"
android:layout_below="@id/imgLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/action_via_email"
android:textColor="@android:color/white"
android:textStyle="bold" />
<Button
android:id="@+id/btnSignUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/action_sign_up"
android:textColor="@android:color/white"
android:textStyle="bold" />
</FrameLayout>
最佳答案
试试这个
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="49dp"
android:text="Button" />
</RelativeLayout>
得到这样的输出
关于android - 在 Framelayout 中添加两个相互接触的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15919465/