2012-03-06 6 views
0

쉽지 만 솔루션을 찾을 수 없습니다. RelativeLayout 안에 3 개의 ImageView가 있습니다. 이 ImageViews는 세 개의 버튼을 나타냅니다 (ImageButton을 사용해 보았습니다. 거기에 같은 문제가 있습니다).ImageView 소스의 크기가 조정되지 않습니다.

세 가지 소스, bluered, green 및 blueyellow는 크기가 * .png 인 파일 (이 경우 버튼/ImageViews 크기보다 큽니다)입니다. 이러한 소스를 ImageViews에 맞게 크기 조정하고 buttonsleftRightMenu의 크기를 사용하고 싶습니다. 소스는 2 차 이미지이기 때문에 쉽습니다. 어디서 잘못 나니?

XML 파일 :

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="match_parent" 
android:id="@integer/leftMenuID" 
> 

<ImageView 
    android:layout_width="@dimen/buttonsLeftRightMenu" 
    android:layout_height="@dimen/buttonsLeftRightMenu" 
    android:src="@drawable/bluered" 
    android:id="@integer/leftMenuButton1ID" 
    android:clickable="true" 
    android:contentDescription="@string/leftMenuButton1ContentDescription" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:scaleType="fitCenter" 
    android:adjustViewBounds="true" 
/> 

<ImageView 
    android:layout_width="@dimen/buttonsLeftRightMenu" 
    android:layout_height="@dimen/buttonsLeftRightMenu" 
    android:id="@integer/leftMenuButton2ID" 
    android:clickable="true" 
    android:src="@drawable/green" 
    android:background="@color/transparent" 
    android:contentDescription="@string/leftMenuButton2ContentDescription" 
    android:layout_below="@integer/leftMenuButton1ID" 
    android:scaleType="fitCenter" 
/> 

<ImageView 
    android:layout_width="@dimen/buttonsLeftRightMenu" 
    android:layout_height="@dimen/buttonsLeftRightMenu" 
    android:id="@integer/leftMenuButton3ID" 
    android:clickable="true" 
    android:src="@drawable/blueyellow" 
    android:background="@color/transparent" 
    android:contentDescription="@string/leftMenuButton3ContentDescription" 
    android:layout_below="@integer/leftMenuButton2ID" 
    android:scaleType="fitCenter" 
/> 

</RelativeLayout> 
+0

전체 답변을 쓸 시간이 없지만 ** weightSum = "3"** 인 LinearLayout **으로 변환 한 다음 각 ImageView를 ** layout_weight = "3"** – bbedward

+0

이러한 접근 방식은 시스템 자원을 덜 사용합니까, 아니면 다른 이점이 있습니까? –

답변

2

이건 그냥 바보 같은 실수였다. 코드는 완벽하게 작동하지만 corrext xml 파일을 부 풀리는 것을 잊지 마십시오.

관련 문제