2013-04-07 3 views
0

내 안드로이드 응용 프로그램에서 UI를 디자인해야합니다. linearlayout (100 %) 내에서 scrollview (70 %) 및 relativelayout (30 %) 영역을 분산해야합니다. 하지만 내 코드에서 그것은 scrollview에서 버튼의 변화와 함께 영역을 변경하고 relativelayout의 영역을 소모합니다. 여기 내 코드는Android : 일정한 크기의 UI 유지

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:weightSum="100"  
> 
<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@+id/lastLayout" 
    android:layout_weight="70"   
    >   
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/linear_layout_add" 
     android:background="@drawable/albumbackground" 
     android:padding="10dp" 
    >   
    </LinearLayout> 
</ScrollView> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/white" 
    android:layout_weight="30" 
    > 

    <ImageButton 
     android:id="@+id/albumAdd" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="24dp" 
     android:layout_marginTop="10dp" 
     android:layout_toLeftOf="@+id/albumremove" 
     android:src="@drawable/add" /> 

    <ImageButton 
     android:id="@+id/albumremove" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="58dp" 
     android:src="@drawable/delete" /> 

    </RelativeLayout>  

다음 UI가 몇 가지 버튼이 enter image description here

처럼 표시하지만 버튼의 더는 UI가이 enter image description here

방법처럼 보여줍니다 증가하지 않을 때 scrollview 및 relativelayout 크기를 일정하게 유지할 수 있습니까? 감사합니다 ...

답변

0

LinearLayout의 두 자녀 모두에 android:layout_height="0dp"을 설정하십시오.

무게는 사용하지 않은 공간을 채우는 것입니다. 자녀가 0 미사용 공간의 크기를 가지고 있다면 원하는대로 나누어집니다.

+0

답장을 보내 주셔서 감사합니다. 그러나 같은 문제는 여기에있다. – andDev

+0

'ScrollView'와'RelativeLayout'에 설정 했습니까? –

+0

예. scrollview 및 relativelayout으로 설정했습니다. – andDev

관련 문제