私のテストAndroidアプリで2×2グリッド(縦1本、横1本)を実現するネストされた線形レイアウトがありますが、 。現在、私は手動で高さを任意の数(150dp)に設定しています。それを修正し、グリッドセル間で高さと幅を均等に分割するにはどうすればよいですか?Androidのネストされた線形レイアウトで、高さと幅を均等に共有する
基本的に私は(2x3,3x3、など)画面を均等に共有するグリッドをいくつでも欲しいですか? (各surfaceView
ビデオを再生する責任がある私は、グリッドレイアウトを使用して、いくつかの問題を抱えていた。)
<?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はビデオの再生を担当します。私はグリッドレイアウトを使用していくつかの問題がありました。 –