2013-12-12 4 views
-1

성별 상자가 이미 배경에 포함 된 레이아웃의 배경을 사용하고 있습니다. 남성과 여성의 이미지가있는 두 개의 작은 ImageView를 배치 할 계획입니다. 내 그래픽 레이아웃에서 두 이미지를 드래그 앤 드롭하여 xml 파일에 marginTop 및 marginLeft 특성을 표시합니다. 문제는 다른 해상도로 내 앱을 실행하려고하면 이미지가 정확한 위치에 배치되지 않는다는 것입니다. 이 문제를 해결하는 방법?해상도가 다른 이미지 배치

이것은 배경의 일부인 성 (gender) 상자의 이미지입니다. 그것은 남성과 여성을위한 두 가지 이미지 (이미지 뷰 제외)가 있습니다.이 성별 상자는 레이아웃 배경에 포함되어 있습니다.

enter image description here

+0

당신은 당신이 무엇을 얻을의 스크린 샷과 무엇을 달성하고자 게시 할 수 있을까요? 매우 명확하지 않기 때문에. 나는 절반의 아이디어가 있지만, 확실하게하고 싶습니다. –

+0

http://developer.android.com/guide/practices/screens_support.html – Riser

답변

1
Try this snippet of code in you xml file. Hope it will help you 

<LinearLayout 
     android:id="@+id/ll_gender" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_centerInParent="true" > 

     <ImageView 
      android:id="@+id/iv_male" 
      android:layout_width="50dp" 
      android:layout_height="50dp" 
      android:src="@drawable/male" /> 

     <ImageView 
      android:id="@+id/iv_female" 
      android:layout_width="50dp" 
      android:layout_height="50dp" 
      android:src="@drawable/female" /> 

    </LinearLayout> 

You can adjust them in your existing xml file accordingly. You can set properties of this linear layout in respect of other layouts in your code so it will not destroy your design on max no of devices. Use Relative layout as the parent of linear layout so you can adjust it more easily or paste your complete xml file code if you still face problem. 
You can use different folders for different screens 

    res/drawable-mdpi/my_icon.png  // bitmap for medium density 
    res/drawable-hdpi/my_icon.png  // bitmap for high density 
    res/drawable-xhdpi/my_icon.png  // bitmap for extra high density 
관련 문제