2
나는이 내 대화에 대해 다음 레이아웃 : 안드로이드 - layout_weight를 가진 여러 버튼의 높이를 설정
내가하지로 첫 번째 버튼을 원하는 : 하단 버튼에 문제가 있습니다
<?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:orientation="vertical">
<TextView
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/practice_question" />
<TextView
android:id="@+id/dialog_select_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:textColor="@color/primary_text"
android:textSize="16sp"
tools:ignore="RtlHardcoded" />
<ListView
android:id="@+id/dialog_select_answers"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/dialog_select_board_button"
style="?attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/practice_look_board" />
<Button
android:id="@+id/dialog_select_answer_button"
style="?attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/practice_answer" />
</LinearLayout>
</LinearLayout>
자른. android:layout_height="wrap_content"
을 설정했지만 도움이되지 않습니다.
P. "Look on the board"에서 "Look on the \ nboard"로 단추 텍스트를 변경하면 모두 정상적으로 작동합니다. 하지만 두 번째 단추를 선택 가능하게 만들고 싶으므로 첫 번째 단추가 부모 전체의 너비와 일치 할 수 있습니다.
솔루션을 시도하십시오 변경되었습니다. 내 질문의 편집을보십시오. 문제가 해결 될 것이므로 답변을 수락하겠습니다. –
@ArtemMostyaev android : layout_below = "@ + id/dialog_select_answers"를 목록보기에서 제거하고 linearlayout에서 android : layout_below = "@ + id/dialog_select_answers"를 추가하십시오. 내 목표로 이것을 구현하려고합니다. 나도 시도해보고 그것이 작동하는지 아닌지 알려주세요. –
예, 작동합니다! 나는 당신의 답을 편집 할 수있는 적절한 레이아웃을 게시 할 것입니다. –