2013-10-09 3 views
0

나는 android에서 차트 응용 프로그램을 개발 중입니다. dp에서 모든 레이아웃 매개 변수를 설정했지만 다른 화면 크기의 정렬에 문제가 있습니다. ..화면 크기가 변경되면서 응용 프로그램 레이아웃이 변경됩니다.

예제 내 로그인 버튼 또는 차트가 일반 4 인치 화면.

OS 버전의 버그입니까, 아니면 각 종류의 화면 크기에 대한 매개 변수를 설정해야합니까? enter image description here

enter image description here

에서 같은 로그인 화면의 스크린 샷 두 개의 서로 다른 모바일

+0

스크린 샷을 공유 할 수 있습니까? –

답변

0

하면 화면 등의 여백에 등 귀하의 버튼, 텍스트 필드를 정렬, 문제의이 종류를 방지하려면

// for aligning it to the left of screen 
     android:layout_alignParentLeft="true" 
// for aligning it to the right of screen 
     android:layout_alignParentRight="true" 
// for aligning it to the Bottom of screen 
     android:layout_alignParentBottom="true" 

위젯은 화면의 하단, 우측 또는 좌측에 각각 원래 위치가 변경되지 않습니다.

대답을 투표하는 것을 잊지 마십시오 :

0

주요 레이아웃으로 상대 레이아웃을 사용하십시오. 그 안에 하나의 LinearLayout 레이아웃을 추가하십시오. 이것은 귀하의 로그인 상자의 컨테이너입니다. android : layout_centerInParent = "true"를 사용하여 정렬을 가운데로 설정하십시오.이 컨테이너에 로그인 상자를 추가하십시오.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:id="@+id/RelativeLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     tools:context=".MainActivity" > 

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

    </LinearLayout> 

    </RelativeLayout > 
관련 문제