2015-01-24 3 views
0

계산기 앱을 만들려고하지만 인터페이스를 디자인 할 때 어려움이 있습니다. 버튼을 화면에 수평으로 채우기를 원합니다. 그러나 그들은 너무 작습니다. 큰 버튼과 모든 화면 크기에 적합한 방법. 이 내 코드는 .XML 파일에ImageButton 안드로이드의 다중 스크린

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/LinearLayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:weightSum="8.5" 
android:orientation="vertical" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context="duy.calculatordemo.MainActivity"> 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="0" 
    android:gravity="right" 
    android:background="#AAAAAA" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:layout_weight="1"/> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:weightSum="4" 
    android:layout_weight="1"> 

    <ImageButton 
     android:id="@+id/btntan" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 

     android:src="@drawable/btn_tan" 
     android:background="@null" /> 

    <ImageButton 
     android:id="@+id/btnsin" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:background="@layout/activity_main" 

     android:src="@drawable/btn_sin" /> 

    <ImageButton 
     android:id="@+id/btncos" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:background="@layout/activity_main" 
     android:src="@drawable/btn_cos" /> 

    <ImageButton 
     android:id="@+id/btnlog" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:background="@layout/activity_main" 
     android:src="@drawable/btn_log" /> 

</LinearLayout> 

enter image description here

은 당신이 나를 도울 수 있습니다! 고맙습니다 !

답변

1

image button에 배경을 채우기 위해 android:scaleType="fitXY"을 사용하십시오. 자세한 내용은 this을 참조하십시오.

+0

대단히 감사합니다. ^^ –

+0

도와 드리겠습니다. :) –

관련 문제