두 파일간에 차이는 없습니다. 이름 만 다릅니다. 그래서
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 3"
android:layout_weight="1"/>
</LinearLayout>
더 clearification이 혀에 따라 다른
If your file name is activity_main.xml use it like this in onCreate()
setContentView(R.layout.activity_main);
If your file name is main.xml use it like this in onCreate()
setContentView(R.layout.main);
이 아니 라이너 레이아웃, 당신은 다음과 같이 변경할 수 있습니다 경우, http://www.mkyong.com/android/android-linearlayout-example/
감사합니다. main.xml (default)과 activity_main.xml을 모두 갖는 것이 R이 빨간색 밑줄 (IDE : Netbeans)을 갖는 이유입니다. import Android. .R; –
gimmegimme