1

에 표시됩니다 ", MDPI (480 * 800). 나는 화면 크기 5.0 장치에서 응용 프로그램을 실행하면", 196ppi (* 854 480), 레이아웃이 바닥에서 끊어집니다. 레이아웃이 다른 장치 및 에뮬레이터 내 레이아웃이 제대로 화면 크기 5.0 에뮬레이터에 표시됩니다

나는 <supports-screens>를 사용하여 시도하지만 어떤 차이를하지 않았다.

layout.xml :

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

    <LinearLayout 
     style="@style/create_trip_activity_components_style" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="30dp" 
     android:gravity="center_vertical" 
     android:orientation="horizontal" > 

     <EditText 
      android:id="@+id/from_location" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="5dp" 
      android:ems="10" 
      android:hint="@string/from_location_hint" 
      android:imeOptions="actionGo" 
      android:imeActionLabel="Ok" 
      android:inputType="text" > 

      <requestFocus /> 
     </EditText> 

     <Button 
      android:id="@+id/use_current_button" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right" 
      android:onClick="useCurrentLocation" 
      android:text="@string/use_current" 
      android:textAppearance="?android:attr/textAppearanceSmall" /> 
    </LinearLayout> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="20dp" 
     android:layout_marginTop="20dp" 
     android:contentDescription="@string/swap_button_contentdescription" 
     android:onClick="swapLocations" 
     android:scaleType="fitStart" 
     android:src="@drawable/swap" /> 

    <EditText 
     android:id="@+id/to_location" 
     style="@style/create_trip_activity_components_style" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="20dp" 
     android:ems="10" 
     android:gravity="left" 
     android:hint="@string/to_location_hint" 
     android:imeOptions="actionGo" 
     android:imeActionLabel="Ok" 
     android:inputType="text" > 
    </EditText> 

    <LinearLayout 
     style="@style/create_trip_activity_components_style" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="25dp" 
     android:gravity="center_vertical" 
     android:orientation="horizontal" > 

     <EditText 
      android:id="@+id/departuretime_date" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:clickable="true" 
      android:ems="10" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:gravity="center" 
      android:hint="@string/departure_date_hint" 
      android:inputType="datetime" > 
     </EditText> 

     <EditText 
      android:id="@+id/departuretime_time" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:clickable="true" 
      android:ems="10" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:gravity="center" 
      android:hint="@string/departure_time_hint" 
      android:inputType="datetime" > 
     </EditText> 

    </LinearLayout> 

    <Button 
     android:id="@+id/pick_match_create_trip" 
     style="@style/big_centered_button_style" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="80dp" 
     android:onClick="pickMatchesButtonClicked" 
     android:text="@string/pick_your_matches" /> 

    <TextView 
     style="@style/create_trip_activity_components_style" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="75dp" 
     android:text="@string/current_location_textlabel" 
     android:textAppearance="?android:attr/textAppearanceSmall" /> 

    <TextView 
     android:id="@+id/current_location_text" 
     style="@style/create_trip_activity_components_style" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:layout_marginTop="5dp" 
     android:text="" 
     android:textAppearance="?android:attr/textAppearanceSmall" /> 

    <ListView 
     android:id="@+id/places_list" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="20dp" 
     android:background="@color/white" > 
    </ListView> 

</LinearLayout> 
+0

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

+0

문제는 에뮬레이터보다 장치에 더 큰 화면이있을 수 있지만 각 방향에서 실제 픽셀이 적어서 결과적으로 낮은'dpi'. 장치 독립적 픽셀 (dp)은 화면 크기가 아닌 인치 당 도트 수와 직접 관련이 있습니다. mdpi, hdpi, xhdpi 등을 위해 다른 레이아웃을 만들어야합니다. – Squonk

+0

@Squonk 장치 화면은 196dpi이고 AVD 화면은 mdpi입니다. 그들은 동일합니다. 그런 다음 레이아웃이 두 ​​가지 모두 비슷해야합니까? – Geek

답변

0

유일한 방법은 XML 레이아웃에서 바로 코딩, 처음부터 설계하는 동안 그래픽 레이아웃에서 사용할 수있는 모든 화면의 방향과 크기로 확인 화려한이다.

+0

질문에서 언급했듯이 장치의 사양과 동일한 사양으로 에뮬레이터를 실행했습니다. 심지어 그것은 다른 견해를 보여준다. – Geek

+0

그래픽보기에서 완벽합니까? – Exceptional

+0

예. 그래픽 레이아웃에서는 모든 객체를 보여줍니다. – Geek

0

당신 AER은 720 DP의 TEH 같은 이미지를 사용하는 경우, 이미지 밀도해야 할 수도 있습니다, 그것은, 이런 식으로 작동 할 수 있습니다 480 * 800, 이미지 밀도는 전화 화면 480 320 DP해야한다 dp (Streak와 같은 tweener 태블릿의 경우) 자세한 내용은

320dp : 일반 전화 화면 (240x320 ldpi, 320x480 mdpi, 480x800 hdpi 등)을 확인하십시오.

480dp : 줄무늬 (480x800mdpi)와 같은 트위너 태블릿.

600dp : 7 인치 태블릿 (600x1024mdpi).

720dp 이상 : 10 "태블릿 (MDPI 720x1280, 800x1280 MDPI 등).

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

나는 내가 7 인치 태블릿에 대한 720 DP, 720 * 1280을 사용하고 내 화면이 600 DP 사진이 내 문제를 해결 받고, 차단되었다가 함께 잘 실행, 비슷한 문제가 있었다 에뮬레이터를 실행하지만 실제 장치에서는 실패합니다. 이 솔루션이 당신에게 도움이 될지 확실하지 않습니다. 하지만 행운을 빕니다.

0

해당 레이아웃에 맞는 테마를 선택했는지 확인하십시오. 나는 또한 같은 문제가 있었다.

관련 문제