2014-07-18 5 views
1

다음과 같은 레이아웃이 있습니다. 하단에는 id = btn이라는 텍스트가있는 버튼이 있습니다.이 버튼은 더 큰 화면 핸드셋에서 잘 보이지만, 작은 화면에서는 보이는 텍스트가없는 선처럼 보입니다. 그것을 고치는 방법?작은 화면 장치에서 안드로이드 버튼이 줄어 듭니다.

감사합니다.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:padding="10dip" > 

    <!-- Name Label --> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="60dp" 
      android:layout_height="100dp" 
      android:src="@drawable/img_na" /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_below="@+id/imageView1" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="10dip" 
      android:text="Name:" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/hide_name" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:layout_marginTop="10dip" 
      android:clickable="true" 
      android:onClick="hideBtnClicked" 
      android:text="hidden (change)" 
      android:textColor="@color/editRed" 
      android:textSize="12dip" 
      android:visibility="gone" /> 
    </RelativeLayout> 

    <!-- Name Value --> 

    <EditText 
     android:id="@+id/name" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" /> 

    <!-- Address Label --> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="15dip" 
      android:text="Address:" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/hide_addr" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:layout_marginTop="10dip" 
      android:clickable="true" 
      android:onClick="hideBtnClicked" 
      android:text="hidden (change)" 
      android:textColor="@color/editRed" 
      android:textSize="12dip" 
      android:visibility="gone" /> 
    </RelativeLayout> 

    <!-- Address Value --> 

    <EditText 
     android:id="@+id/address" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" /> 

    <!-- Phone Number Label --> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="15dip" 
      android:text="Phone:" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/hide_ph" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:layout_marginTop="10dip" 
      android:clickable="true" 
      android:onClick="hideBtnClicked" 
      android:text="hidden (change)" 
      android:textColor="@color/editRed" 
      android:textSize="12dip" 
      android:visibility="gone" /> 
    </RelativeLayout> 

    <!-- Phone Value --> 

    <EditText 
     android:id="@+id/phone" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" /> 

    <!-- Location Value --> 

    <EditText 
     android:id="@+id/location" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="5dip" 
     android:layout_marginTop="15dip" /> 

    <TextView 
     android:id="@+id/distance" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="5dip" 
     android:layout_marginTop="15dip" /> 

    <Button 
     android:id="@+id/btn" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:minHeight="40dp" 
     android:text="to retain heigth" /> 

</LinearLayout> 

편집 : scrollvew을 제안하지만 버튼이 항상 볼 수 싶어, 그래서 나는 그것이 scollable 만들고 싶어하지 말아 주셔서 감사합니다. 둘째로 내용을 스크롤 할 수있게 만드는 데 그리 오래 걸리지 않습니다. 단 몇 dps 밖에 실행되지 않습니다. 그래서 나는 스크롤보기를 피하고자합니다. 난 단지 화면 크기에 따라 전체 높이가 현저히 줄어들도록하고 싶습니다.

+2

'ScrollView'를 사용하십시오. – Apoorv

답변

1

ScrollView를 사용하여 내용을 모든 화면 크기로 스크롤 할 수 있습니다.

희망이 있습니다.

1
 yes use scroll view 


    <ScrollView android:id="@+id/ScrollView01" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fillViewport="true" 
    android:layout_width="fill_parent" 
    android:background="#ffffff" 
    android:layout_height="wrap_content"> 
    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    > 

    <Button 
    android:id="@+id/button1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:text="Button" /> 

    <Button 
    android:id="@+id/button2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/button1" 
    android:layout_centerHorizontal="true" 
    android:text="Button" /> 
    <Button 
    android:id="@+id/button3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/button2" 
    android:layout_alignParentLeft="true" 
    android:layout_centerHorizontal="true" 
    android:text="Button" /> 
    <Button 
    android:id="@+id/button4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/button3" 
    android:layout_alignParentRight="true" 
    android:layout_centerHorizontal="true" 
    android:text="Button" /> 
    <Button 
    android:id="@+id/button5" 
    android:layout_width="wrap_content" 
    android:layout_height="70dp" 
    android:layout_below="@+id/button4" 
    android:layout_alignParentRight="true" 
    android:layout_centerHorizontal="true" 
    android:text="Button" /> 
    <Button 
    android:id="@+id/button6" 
    android:layout_width="wrap_content" 
    android:layout_height="150dp" 
    android:layout_below="@+id/button5" 
    android:layout_alignParentLeft="true" 
    android:layout_centerHorizontal="true" 
    android:text="Button" /> 
    <Button 
    android:id="@+id/button7" 
    android:layout_width="wrap_content" 
    android:layout_height="150dp" 
    android:layout_below="@+id/button6" 

    android:layout_centerHorizontal="true" 
    android:text="Button" /> 
    </RelativeLayout> 
    </ScrollView> 
+0

안녕하세요. 응답 해 주셔서 감사합니다.하지만 편집에서 언급했듯이 언급 된 이유로 scrollview를 사용하고 싶지 않습니다. –

0

그런 경우에는 GridLayout을 확인하는 것이 좋습니다. 그러나 GridLayout은 API Level 14 또는 그 이상이 필요합니다! 14 레벨 미만의 API 레벨에서 작동하는 모든 기기는 앱과 호환되지 않습니다.

또한 API 레벨이 14 미만인 v7 gridlayout 라이브러리를 사용할 수 있습니다. Google을 통해 예제를 쉽게 찾을 수 있다고 생각합니다.

관련 문제