<?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:gravity="center|center_horizontal|fill"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img" />
</LinearLayout>
main.xml에 이렇게 만들어놓고
여기에다 이미지 위에 버튼3개를 만들고싶은데 어떤소스를입력하면되나요..ㅠㅠ 완전 생초보라 책을봐도모르겠네요
좀 도와주세요
<?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:gravity="center|center_horizontal|fill"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
님이 말씀하신대로 해봤는데 역시 배경이미지만나오고 버튼은 안나와요..이거 옛날에 해봣는데 안되서 물어보는거에요 ㅠㅠ
ImageView위에 버튼을 올리실려면
LinearLayout으로 하시면 안되고요..
RelativeLayout 이나 FrameLayout으로 레이아웃을 설정하셔야 합니다...
간단하게.. 버튼을 우측 아래에 배치한 예제 xml 입니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" android:layout_alignParentRight="true" android:layout_alignParentBottom="true">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
ㅇㅅ ㅇ;;;
main.xml 왼쪽 하단에 보시면 Graphical Layout , main.xml 탭이 있잔요
거기서 Graphical Layout 누르시면 아마 화면이 보일꺼에요
그럼 거기 왼쪽에 위젯 목록이 많이 보이실탠대
거기서 Button을 찾아서 화면에다가 드래그 앤 드롭만 하셔도
버튼이 생성되요 ㅇㅇ