<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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#0000ff" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ff0000" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000" >
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#00ff00" >
</LinearLayout>
</LinearLayout>
일단 이게 제가 만든 XML이구요..

이렇게 나오는데 이 XML을 JAVA코드로만 이용해서 해야되는데...
package com.cookandroid.chapter5_7;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.LinearLayout;
public class Chapter5_7Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT, 1);
LinearLayout baseLayout1 = new LinearLayout(this);
baseLayout1.setOrientation(LinearLayout.VERTICAL);
baseLayout1.setBackgroundColor(Color.BLUE);
setContentView(baseLayout1, params1);
}
protected void onCreate1(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT, 1);
LinearLayout baseLayout2 = new LinearLayout(this);
baseLayout2.setOrientation(LinearLayout.VERTICAL);
baseLayout2.setBackgroundColor(Color.DKGRAY);
setContentView(baseLayout2, params2);
}
}
이렇게 해봤는데 이렇게 해야되는지 아님 한개의 OnCreate안에 두개를 해야되는지..
중복 리니어레이아웃은 어떻게 해야되는지 정말 궁금합니다 ㅜㅜ 가르쳐주세요..!!!