ボタンの幅が画面の半分になるように (XML で) 設定する方法。ラップコンテンツのみが見つかり、親(画面全体を埋める)と一致し、dpの正確な量(例:50dp)が見つかりました。画面を正確に保持する方法は?
<RelativeLayout 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:weightSum="2"
>
<Button
android:id="@+id/buttonCollect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="przycisk" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Button" />