이미지 응용 프로그램을 만들려고하고 있으며 내 xml 파일 중 하나에서 버튼 및 이미지보기가 있습니다. 이미지보기에 기본 그림이 있습니다. 일부 장치에서는 작거나 너무 큽니다. 그림이 화면 바깥 쪽이나 단추 위로 나오지 않아요. 내가 어떻게 할까? android:gravity="center"
을 가지고그림이 휴대 전화 화면 외부로 이동합니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/btakePic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Take Picture" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/btakePic"
/>
</RelativeLayout>
필요 당신이 도움이 android:layout_width="fill_parent"
희망이 있기 때문에 : 여기에 어쩌면 이것은 당신이 원하는없는 것입니다 XML 코드
<RelativeLayout 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" >
<Button
android:id="@+id/btakePic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Take Picture" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="400dp"
android:gravity="center"
android:src="@drawable/android_syh" />
</RelativeLayout>
전체 XML 파일을 게시 할 수 있습니까? – 0gravity
thats the entire layout – brian
이것이 xml 레이아웃 파일의 전체 내용이라면 다른 문제가 있습니다. 상위 레이아웃 요소는 어디에 있습니까? –