0

좋습니다. 문제점 : 배경 이미지에 내장 된 "상자"안에 표시 할보기가 필요한 레이아웃이 있습니다. 그래서 .. 정확한 레이아웃이 필수입니다. 내가 레이아웃을 가지고있어 에뮬레이터와 Samsung Galaxy S에서 멋지게 보였지만 Droid X에 던지면 뷰가 위로 이동합니다. 문제는 두 전화기가 HDPI가있는 중간 화면으로 간주된다는 것입니다. 분명히 다른 레이아웃 폴더를 사용하여 수정할 수 없습니다. 매니페스트에서 "anyDensity"를 false로 설정했습니다. minSDK 3 트릭을 시도했습니다. 내 리소스가 drawable-hdpi 폴더에서 빠져 나오고 있지만 차이를 만들어서는 안됩니다. 내가 상상할 수있는 유일한 것은 이것이 (DIP에서도) 내가 제공하고있는 특정 마진 값이다. 그러나 특정 위치의보기가있는 레이아웃을이 레이아웃없이 어떻게 구현할 수 있는지는 잘 모릅니다. 어떤 도움을 주시겠습니까 ?? Commonsware는이 곳에 당신을두고 있습니다. 고마워.딥 및 동일한 해상도로도 다른 장치에서 다르게 나타나는 화면

편집 : 더 생각하면할수록 생각이 잘못되었습니다. (안드로이드 레이아웃을 코딩 한 이후로 오랜 시간이 걸렸습니다.) DIP은 정확하게해야 할 일을하고 있습니다. 크기는 모든 스크린에 정확히 동일하지만, 원하는 것은 화면 크기로 뷰를 확장하는 것입니다. 따라서 화면이 커지면 여백과 간격이 화면과 함께 커집니다. 본질적으로 필자의 전체 레이아웃에 fill_parent가 필요하지만 정확한 레이아웃에서는 사용할 수 없습니다. 어떤 아이디어?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/background" > 

    <TextView 
     android:layout_height="wrap_content" 
     android:layout_width="150dp" 
     android:layout_marginTop="20dip" 
     android:layout_marginRight="10dip" 
     android:layout_gravity="right" 
     android:gravity="center_horizontal" 
     android:text="Text Here" 
     android:textSize="15dip" 
     android:textColor="#253B85" /> 

    <TextView 
     android:id="@+id/code" 
     android:layout_height="wrap_content" 
     android:layout_width="150dp" 
     android:layout_marginTop="10dip" 
     android:layout_marginRight="10dip" 
     android:layout_gravity="right" 
     android:gravity="center_horizontal" 
     android:text="5D6" 
     android:textSize="9dip" 
     android:textColor="#000000" /> 

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

     <ImageView 
      android:id="@+id/icon" 
      android:layout_width="90dip" 
      android:layout_height="90dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginTop="10dip"/> 

     <TextView 
      android:id="@+id/name" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_marginTop="19dip" 
      android:layout_marginRight="20dip" 
      android:layout_toRightOf="@id/icon" 
      android:layout_alignParentRight="true" 
      android:gravity="right" 
      android:text="Really Long Name" 
      android:textSize="17dip" 
      android:textColor="#253B85" /> 

     <TextView 
      android:id="@+id/importantInfo" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_marginTop="5dip" 
      android:layout_marginRight="20dip" 
      android:layout_below="@id/name" 
      android:layout_alignParentRight="true" 
      android:gravity="right" 
      android:text="50% off" 
      android:textSize="30dip" 
      android:textStyle="bold" 
      android:textColor="#253B85" /> 

     <TextView 
      android:id="@+id/dateLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="20dip" 
      android:layout_marginTop="22dip" 
      android:layout_below="@id/icon" 
      android:text="date: " 
      android:textColor="#253B85" /> 

     <TextView 
      android:id="@+id/dateText" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="22dip" 
      android:layout_below="@id/icon" 
      android:layout_toRightOf="@id/dateLabel" 
      android:text=" " 
      android:textColor="#253B85" /> 

     <TextView 
      android:id="@+id/moreInfo" 
      android:layout_width="fill_parent" 
      android:layout_height="33dip" 
      android:layout_marginLeft="22dip" 
      android:layout_marginTop="3dip" 
      android:layout_marginRight="24dip" 
      android:layout_below="@id/dateLabel" 
      android:gravity="center" 
      android:maxLines="2" 
      android:textSize="10dip" 
      android:text=" " 
      android:textColor="#253B85" /> 

     <ImageView 
      android:id="@+id/qrIcon" 
      android:layout_width="fill_parent" 
      android:layout_height="106dip" 
      android:layout_marginLeft="22dip" 
      android:layout_marginTop="11dip" 
      android:layout_marginRight="24dip" 
      android:layout_below="@id/moreInfo" /> 

    </RelativeLayout> 

    <Button 
     android:id="@+id/submitButton" 
     android:layout_width="160dip" 
     android:layout_height="40dip" 
     android:layout_marginTop="14dip" 
     android:layout_gravity="center_horizontal" 
     android:onClick="buttonRedeemOnClickListener" 
     android:background="@drawable/button_background" 
     android:text="Redeemed Coupon" 
     android:textColor="#FFFFFF" /> 

</LinearLayout> 
+0

:) 크기 때문에 : Motorola는 480 x 854 픽셀이지만 Galaxy S는 480 x 800 픽셀이지만 Android의 경우 640dp x 480dp 이상이므로 둘 다 큰 것으로 간주됩니다. 이 [table] (http://developer.android.com/guide/practices/screens_support.html#testing)도 참조하십시오. – Adinia

+0

나는 전화 스크린이 동일하지 않다는 것을 완전히 이해한다. 내 문제는 레이아웃이 일치하도록 확장되지 않는다는 것입니다. 그것이 내가 도움이 필요한 것입니다. – honeal

+0

아마도 백그라운드 드로어 블이 스케일되는 방식 때문에 그럴 수 있습니다. –

답변

1

매니페스트 파일에 추가 ::: 현재, 당신이 다른 크기에 대해 서로 다른 레이아웃을 코딩 시도 생각하지 않는다 코드에

<supports-screens android:smallScreens="true" android:resizeable="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"></supports-screens> 
+0

여전히 이동 중입니다. 나는 여백이 동일하다는 것을 알아 차렸지만, 배경은 Droid X로 확장되고 있지만 여백은 확대되지 않는다. 어떻게하면 같은 확장을 달성 할 수 있을까요? – honeal

0

를 기준으로합니다. 얼마나 많은 크기의 코드를 작성 하느냐에 따라 시간이 많이 걸리지 만 그렇게하는 데는 상당한 가치가 있습니다. 내가 볼 수있는 유일한 문제는 모든 화면 해상도에 대한 레이아웃을 만들려고하는 경우에 문제가되지 않는다는 것입니다.

관련 문제