2012-03-28 3 views
1

대부분의 .xml 파일은 내 화면에 결함이있어 크기가 보통 일부 화면에서는 더 커지고 일부 화면은 더 낮아집니다. 나는 픽셀 (픽셀)을 사용합니다.안드로이드 .xml 디자인

새로운 휴대 전화는 더 많은 픽셀 비율로 끝나기 때문에 이것이 내 선택에 나쁜 선택 일 수 있음을 알고 있습니다. 예 : 삼성 Galaxy Nexus는 모든 텍스트를 작은 텍스트로 만듭니다.

미래의 휴대폰에 사용하기에 훨씬 적합한 유형은 무엇입니까? 추가

:

나는 오랫동안 선형 레이아웃을 사용하고 있지만, 지금은 필요가 긴 메뉴 스크롤 나는있는 ScrollView는 선형 레이아웃을 둥지있는 ScrollView를 중첩 RelativeLayout의 설계. 뷰를보다 잘 제어하기 위해 tableLayout을 중첩하는 것이 더 좋은 옵션일까요?

못생긴 것처럼 보이기 때문에 질문 화면이 넘치지 않았 으면합니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/layout_root" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

      <TextView 
       android:id="@+id/tab_tv_one" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/auto_Action" 
       android:background="#666666" 
       android:text="@string/options_dialog_menu_Action" 
       android:textSize="27px" 
       /> 

      <RadioGroup 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical"> 

      <RadioButton 
       android:id="@+id/FirstOption" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/manual_Action" 
       android:layout_below="@+id/tab_tv_one" 
       android:text="@string/options_dialog_menu_Auto_Action" 

       android:textSize="27px" /> 

      <RadioButton 
       android:id="@+id/SecondOption" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/tab_tv_two" 
       android:layout_below="@+id/auto_Action" 
       android:text="@string/options_dialog_menu_Manual_Action" 
       android:textSize="27px" 
       android:onClick="onClick" 
       android:clickable="true" 

       /> 

      <RadioButton 
       android:id="@+id/ThirdOption" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/tab_tv_two" 
       android:layout_below="@+id/manual_Action" 
       android:textSize="27px" 
       android:onClick="onClick" 
       android:clickable="true" 

       /> 

      </RadioGroup> 



      <TextView 
       android:id="@+id/tab_tv_two" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/text_size" 
       android:layout_below="@+id/manual_Action" 
       android:background="#666666" 
       android:text="@string/options_dialog_menu_Layout_Options" 
       android:textSize="27px" 
       /> 

      <TextView 
       android:id="@+id/text_size" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/background_clr" 
       android:layout_below="@+id/tab_tv_two" 
       android:text="@string/options_dialog_menu_Text_Size" 
       android:textSize="27px" 
       android:onClick="onClick" 
       android:clickable="true" 

       /> 

      <TextView 
       android:id="@+id/Options_clr" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_above="@+id/brightness_ctrl" 
       android:layout_below="@+id/text_size" 
       android:text="@string/options_dialog_menu_Color_Options" 
       android:textSize="27px" 
       android:onClick="onClick" 
       android:clickable="true" 

       /> 

      <TextView 
       android:id="@+id/brightness_ctrl" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/background_clr" 
       android:text="@string/options_dialog_menu_Brightness_color" 
       android:textSize="27px" 
       android:onClick="onClick" 
       android:clickable="true" 

       /> 
      <TextView 
       android:id="@+id/backToBasics" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/brightness_ctrl" 
       android:text="@string/options_dialog_menu_Back_To_Basics" 
       android:textSize="27px" 

       android:onClick="onClick" 
       android:clickable="true" 
       /> 


    </LinearLayout> 
    </ScrollView> 
</RelativeLayout> 
+1

픽셀 대신 dp를 사용해야한다고 생각합니다. – kosa

답변

1

픽셀을 사용하지 마십시오. dp (일명 농도 불균형 픽셀)를 사용하십시오. 그렇지 않으면, 당신이 주목 한대로, 크기는 밀도에 의존 할 것이고, 이는 좋지 않다.

갤럭시 넥서스뿐만 아니라 ldpi 전화도 hdpi와 다른 모양을 보이는 mdpi와 다르게 보일 것입니다. 특히보기 크기와 관련하여 px 크기를 사용할만한 이유가 거의 없습니다.

추가 질문에 관해서는 레이아웃이 어떻게 보이길 원하는지에 전적으로 달려 있습니다. 코드를 보지 않고 적어도 당신이 무엇을보고 싶어 하는지를 아는 것없이 (지금 보는 것과 비교해), 아무도 정말로 그 것에 대답 할 수 없을 것입니다.

+0

코드를 추가하겠습니다. 질문 화면을 너무 많이 범람하고 싶지 않았습니다. – sdfwer

+0

그래서 픽셀을 dp로 바꾸는 것 이외에는 (아무리 고통 스러울 지 모르지만 그럴 가치가 있습니다) 무리한 일은하지 않습니다. 원하는대로 레이아웃을 표시하는 데 문제가없는 경우가 아니면 그대로 두십시오. 당신이 테이블 레이아웃의 기능을 필요로한다면, 그것을 볼 수있는 이유가 없으며 나중에 필요할 때 언제든지 전환 할 수 있습니다. –