2014-11-25 2 views
0

Horizontal LinearLayout에 일부 ImageView가 있습니다. 크기를 백분율 모드로 설정했습니다.자리 표시자를 chnaging하지 않고 이미지 크기를 변경하십시오.

<LinearLayout 
android:weightSum="1" 
android:orientation="horizontal" > 

    <ImageButton 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.25" 
    android:scaleType="fitStart" 
    android:src="@drawable/pjc_news_icon" /> 

</LinearLayout> 

이제 소프트웨어를 소형 장치에 설치하면 이미지의 너비가 부모 레이아웃의 지정된 퍼센트에 맞게 줄어 듭니다. 그들의 높이도 작아 질 것이다. 그러나 그들의 장소 홀더의 높이는 변하지 않습니다. 나는 그들이 바닥에 쓸모없는 공백이 있음을 의미한다.

내 문제를 어떻게 해결할 수 있습니까?

+0

전체 xml을 여기에 붙여주십시오. – Nitesh

답변

0

나는 혼자 답변을 찾았습니다.

"adjustViewBounds"속성을 ImageView에 추가하고 값을 true로 설정했습니다. ImageView 아래의 공간이 제거됩니다.

<LinearLayout 
android:weightSum="1" 
android:orientation="horizontal" > 

    <ImageButton 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.25" 
    android:scaleType="fitStart" 
    android:src="@drawable/pjc_news_icon" /> 

</LinearLayout> 
0

다른보기를 추가하여 나머지 공간을 덮어보십시오.

<LinearLayout 
android:weightSum="1" 
android:orientation="horizontal" > 

<ImageButton 
android:layout_width="0dp" 
android:layout_height="wrap_content" 
android:layout_weight="0.25" 
android:scaleType="fitStart" 
android:src="@drawable/pjc_news_icon" /> 

<View 
    android:layout_width="0dp" 
    android:layout_height="1dp" 
    android:layout_weight="0.75" 
/> 

</LinearLayout> 

그냥 시도해보십시오.

관련 문제