2012-07-13 2 views
0

이미지 응용 프로그램을 만들려고하고 있으며 내 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> 
+0

전체 XML 파일을 게시 할 수 있습니까? – 0gravity

+0

thats the entire layout – brian

+0

이것이 xml 레이아웃 파일의 전체 내용이라면 다른 문제가 있습니다. 상위 레이아웃 요소는 어디에 있습니까? –

답변

0

입니다.

+0

이 다소 도움이 화면이나 2.7 인치 휴대 전화를 제외하고 버튼을 통해 갈 수 있지만 아직까지는 그림을 가지고 사진 버튼을 바로 위에 갈 수있는 방법은 무엇입니까? – brian

+0

그림이 전체 화면을 덮지 않는다는 의미입니까? 태블릿에서 그림을 더 크게하려면 높이를 400dp로 설정 한 다음 부모를 채우기 위해 높이를 설정하기 때문입니다. ID = "@ + ID/imageView1는" 안드로이드 : layout_width = "fill_parent" 안드로이드 : layout_height = "fill_parent" 안드로이드 : layout_above = "@ + ID/btakePic – 0gravity

+0

확인을 나는 그것을 ... 그 <이미지 뷰 안드로이드를 얻었다 " android : src ="@ drawable/android_syh "/> – brian