0
2つのボタンのレイアウトのために、画面の下部に2つのボタンを使いたいと思います。 alignParentButtom属性を持つメインアクティビティのフィールドですが、動作していません。xmlファイルを含むインクルードウィジェットの内容を画面下部に設定する方法
これは私のメインのxmlファイル
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/frag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
であり、あなたはこのような何かをすべき
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="CONNECT"
android:id="@+id/open"
android:textColor="#ffffff"
android:layout_weight="1"
/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="DISCONNECT"
android:id="@+id/close"
android:textColor="#ffffff"
android:layout_weight="1"/>
</LinearLayout>
Why this image is not according to its attribute of layout_height="wrap_content"
をこれはうまくいったフィールドはwrap_contentではなくmatch_parentのスペースを占有しています。 あなたの提案した変更後のスクリーンショットで更新された質問 – Swarnveer
変更内容を正確に更新してください。 –
が完了しました。アップロードされたスクリーンショットを確認してください。 – Swarnveer