2x2 그리드 (세로 1 개, 가로 1 개)를 얻기 위해 내 테스트 안드로이드 앱에 중첩 선형 레이아웃을 사용하고 있지만, 전체 셀을 균등하게 채우는 데 문제가 있습니다. . 현재 수동으로 높이를 임의의 숫자 (150dp)로 설정했습니다. 그것을 고치고 그리드 셀 사이의 높이와 너비를 균등하게 나누는 방법은 무엇입니까?높이와 너비를 균등하게 공유하기 위해 안드로이드의 중첩 선형 레이아웃
기본적으로 나는 (2x3, 3x3 등) 화면을 균등하게 공유 할 수있는 가능한 그리드를 원하십니까? 다음과 같이 내부 LinearLayout
에 대한
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearlayout_0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearlayout_10"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:orientation="horizontal" >
<SurfaceView
android:id="@+id/video_11_surfaceview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<SurfaceView
android:id="@+id/video_12_surfaceview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout_11"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="horizontal" >
<SurfaceView
android:id="@+id/video_21_surfaceview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<SurfaceView
android:id="@+id/video_22_surfaceview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
대신 GridLayout을 사용하는 것이 좋습니다 – SillyFidget
각 surfaceView는 비디오를 재생해야합니다. 그리드 레이아웃을 사용할 때 몇 가지 문제가있었습니다. –