2011-08-17 2 views
0

는 이미이 계산을 사용하고 있습니다 : 화면을 3으로 균등 분할하는 방법은 무엇입니까?

size = act.getWindow().getDecorView().getWidth()/3; 

int dip = (int)TypedValue.applyDimension(
       TypedValue.COMPLEX_UNIT_DIP, 
       size, 
       r.getDisplayMetrics() 
     ); 

그러나, 내 이미지가 너무 크다. 내가 무엇을해야 하나?

<LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical"> 

     <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:src="@drawable/example" 
        weight="1" /> 

     <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:src="@drawable/example" 
        weight="1" /> 

     <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:src="@drawable/example" 
        weight="1" /> 

  </LinearLayout> 

또한 이미지의 크기를 조절할 방법을 변경하기 위해 ScaleType 속성을 사용할 수 있습니다,이 도움이되기를 바랍니다 : 당신의 XML을 정의 할 때

+0

'LinearLayout'과'weight' 속성은 옵션이 아닙니까? – dmon

답변

5

하는 간단한 방법은 레이아웃 무게가 될 것입니다!

관련 문제