여기서 볼 수 있듯이 노란색, 초록색, 파란색 및 자주색으로 둘러싸인 4 개의 선형 레이아웃을 만들어 여러 가지 수평선을 구별했습니다. 나는이 네 가지 레이아웃 모두를 적색으로 표시된 메인 선형 레이아웃의 맨 아래에 앵커하고 싶습니다. 내 문제에 대한 가장 쉬운 해결책을 찾고 있었다. 메인 레이아웃의 경우 RelativeLayout을 사용하지만, 네 개의 선형 레이아웃을 모두 맨 아래에 고정시키고이 순서대로 서로 겹치게하려면 어떻게해야합니까? 코드를 게시하지 않아서 미안하지만 모든 버튼의 코드가 너무 길어질 수 있습니다.4 선형 레이아웃을 선형 레이아웃의 맨 아래에 고정하려면 어떻게해야합니까?
하단에있는 모든 레이아웃을 설정하는 부모 Layout.Then 사용 alignParentBottom 속성으로<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/po"
android:orientation="vertical" >
<EditText
android:id="@+id/txtQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
/>
<Button
android:id="@+id/btnClear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Clear"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="fill_vertical"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="10" >
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Q" />
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="W"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="E"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="R"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="T"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Y"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="U"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="I"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="O"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="P"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="9" >
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="A" />
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="S"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="D"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="F"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="G"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="H"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="J"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="K"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="L"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10" >
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Z" />
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="X"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="C"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="V"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="B"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="N"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="M"
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text=","
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="."
/>
<Button
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="\?"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="bottom|center"
android:orientation="horizontal"
android:weightSum="100" >
<Button
android:layout_weight="25"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Space"
/>
<Button
android:layout_weight="75"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Bkspc"
/>
</LinearLayout>
</LinearLayout>
당신은 부모보기로 alignParentBottom, 사용 RelativeLayout의를 사용해야합니다. 가능하면 코드를 보여주세요. –
@ 프리스가 게시되었습니다. 나는 또한 txtQuestion과 btnClear를 맨 위에두고 싶다. –