2012-07-24 6 views
0

내 앱은 텍스트가있는 화면의 버튼으로 구성되어 있습니다. 그것으로 정말 간단합니다. 나는 다른 가상 전화에 내 응용 프로그램을 테스트 할 때Android 개발 : 다양한 유형의 스마트 폰에 맞게 내 앱 만들기

는하지만 다른 보인다. 이제는 이미지를 사용하지 않으므로 이미지가 드로어 블 폴더에 있고 다른 드로어 블에 모두 수용되지 않는 한 가정합니다. * * 폴더는 문제가되지 않습니다.

하지만 모든 스마트 폰 화면에 맞게 XML을 코드를 어떻게.

XML :

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

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:padding="@dimen/padding_medium" 
     android:text="@string/welsh_libs" 
     android:textColor="#FF0066" 
     android:textSize="30dip" 
     android:textStyle="bold" 
     tools:context=".WelshLibraries" /> 

</LinearLayout> 

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

    <Button 
     android:id="@+id/button2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#6088A1" 
     android:textColor="#FFFFFF" 
     android:text="@string/news" /> 

    <Button 
     android:id="@+id/button3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#50C0E9" 
     android:textColor="#000000" 
     android:text="@string/find_lib" /> 

    <Button 
     android:id="@+id/button4" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#6088A1" 
     android:textColor="#FFFFFF" 
     android:text="@string/free_res" /> 

    <Button 
     android:id="@+id/button5" 
     android:layout_width="285dp" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#50C0E9" 
     android:text="@string/ask_lib" 
     android:textColor="#000000" /> 

    <Button 
     android:id="@+id/button6" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#6088A1" 
     android:text="@string/find_book" 
     android:textColor="#FFFFFF" /> 

    <Button 
     android:id="@+id/button7" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#50C0E9" 
     android:text="@string/register" 
     android:textColor="#000000" /> 

    <Button 
     android:id="@+id/button8" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:layout_marginLeft="18dp" 
     android:background="#6088A1" 
     android:text="@string/login" 
     android:textColor="#FFFFFF" /> 

</LinearLayout> 

<ImageView 
    android:id="@+id/image1" 
    android:layout_width="190dp" 
    android:layout_height="0dip" 
    android:layout_marginBottom="5dp" 
    android:layout_marginLeft="70dp" 
    android:layout_weight="1" 
    android:contentDescription="@string/desc" 
    android:src="@drawable/waglogo" 
    android:visibility="visible" /> 

내가 측정 단위로 민주당의를 사용하고 있지만, 나는 내가 알고 사용할 수있는 유일한 단위로 이해의 PXS, EMS와 웹 사이트를 설계 좋아하지 % s을 (를) 사용할 수 있습니다.

어떤 도움이나 사람들이 많이 주시면 감사하겠습니다 제공 할 수 있습니다 연결합니다. 감사합니다, 댄

P.S. 또한 앱로드시 현재 버튼 아래에 8 개의 버튼을 추가하려면 아래로 스크롤하는 방법을 찾고 있습니다. 어떤 아이디어?

답변

1

공식 Android 개발자 사이트를 아직 보지 않았다면 참조하십시오. 다양한 화면을 지원하는 방법에 대한 기사가 있습니다 : http://developer.android.com/guide/practices/screens_support.html.

또한 당신이 버튼을 스크롤하려면 버튼을 포함하는 ScrollView 당신의 LinearLayout으로 둘러싸고 있습니다. 이런 식으로 뭔가 :

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

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    android:padding="@dimen/padding_medium" 
    android:text="@string/welsh_libs" 
    android:textColor="#FF0066" 
    android:textSize="30dip" 
    android:textStyle="bold" 
    tools:context=".WelshLibraries" /> 

    </LinearLayout> 

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

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

<Button 
    android:id="@+id/button2" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#6088A1" 
    android:textColor="#FFFFFF" 
    android:text="@string/news" /> 

<Button 
    android:id="@+id/button3" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#50C0E9" 
    android:textColor="#000000" 
    android:text="@string/find_lib" /> 

<Button 
    android:id="@+id/button4" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#6088A1" 
    android:textColor="#FFFFFF" 
    android:text="@string/free_res" /> 

<Button 
    android:id="@+id/button5" 
    android:layout_width="285dp" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#50C0E9" 
    android:text="@string/ask_lib" 
    android:textColor="#000000" /> 

<Button 
    android:id="@+id/button6" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#6088A1" 
    android:text="@string/find_book" 
    android:textColor="#FFFFFF" /> 

<Button 
    android:id="@+id/button7" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#50C0E9" 
    android:text="@string/register" 
    android:textColor="#000000" /> 

<Button 
    android:id="@+id/button8" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="18dp" 
    android:background="#6088A1" 
    android:text="@string/login" 
    android:textColor="#FFFFFF" /> 

</LinearLayout> 

</ScrollView> 

<ImageView 
android:id="@+id/image1" 
android:layout_width="190dp" 
android:layout_height="0dip" 
android:layout_marginBottom="5dp" 
android:layout_marginLeft="70dp" 
android:layout_weight="1" 
android:contentDescription="@string/desc" 
android:src="@drawable/waglogo" 
android:visibility="visible" />