내 화면을 두 부분으로 나누고 싶습니다. LinearLayout
이 있고 두 개의 LinearLayouts
이 다시 포함되어 있습니다.Android 레이아웃 부문
두 개의 두 부분을 어떻게 나누는가?
내 화면을 두 부분으로 나누고 싶습니다. LinearLayout
이 있고 두 개의 LinearLayouts
이 다시 포함되어 있습니다.Android 레이아웃 부문
두 개의 두 부분을 어떻게 나누는가?
그냥 추가 :
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
을 둘 수 있습니다. layout_weight
매개 변수가 동일하면 공간의 양이 고르게 분배됩니다.
이전 질문에 대한 답변 중 일부만 받아 들여야합니다.
이 예제가 도움이되는지 확인하십시오.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/rootlinearlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/linearlayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/et01"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="First TextBox"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/et02"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Another TextBox"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
안녕하세요, 답장을 보내 주셔서 감사합니다, 나는 두 번째로 수직으로 화면을 나누고 싶습니다, "AnotherTextbox"는 "First Text box"다음에오고 있습니다. 첫 번째 50 %, 50 두 번째로. 어떤 제안? – ramsbh
두 EditText에서 android : layout_height = "match_parent"를 사용해보세요. 이 잘 작동합니다. –
일반적으로 나는 이것을 위해 android : layout_weight = "1"을 사용합니다. 또한 테이블 레이아웃을 사용할 수 있습니다.
우리는 조각 의 모두 android:layout_width="0dp"
및 android:layout_weight="1"
을 사용할 수 있으며 이들의 부모에, 우리는 단지 답변에 대한 응답을 읽을 android:layout_width="fill_parent"
를 사용할 수 있습니다. 알게 .. 어떻게 그들을 나누고 싶니? 세로로 (서로 겹쳐서) 또는 가로로 (서로의 측면에 나타남)? – kishu27