2010-08-05 6 views
2

Facebook 위젯을 보면 4x2 크기의 셀을 인식했으며 표준 크기가 아닙니다. 이 크기의 위젯 (320x200 또는 294x146 픽셀 중 하나)을 다시 만들려고했으나 모든 장치에서 위젯이 잘 보이지 않습니다. 위젯 레이아웃은 다음과 같습니다.Android 4x2 위젯

<?xml version="1.0" encoding="utf-8"?> 
<!-- Portrait --> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/widget" 
    android:background="@drawable/widget_bg" 
    > 

     <TextView android:id="@+id/widget_title" 
      android:layout_width="fill_parent" 
      android:layout_height="60dip" 
      android:layout_marginTop="1dip" 
      android:textSize="20.0sp" 
      android:maxLines="3" 
      android:textColor="#000" 
      android:textStyle="bold" 
      android:gravity="center" 
      android:layout_marginLeft="10dip" 
      android:layout_marginRight="10dip" 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentTop="true" 
      android:ellipsize="end" 
      /> 

      <ImageView android:id="@+id/widget_thumb" 
      android:layout_width="304dip" 
      android:layout_height="90dip" 
      android:layout_alignParentLeft="true" 
      android:layout_marginLeft="7dip" 
      android:src="@drawable/thumb_placeholder_large" 
      android:adjustViewBounds="true" 
      android:layout_below="@+id/widget_title" 
      android:background="#000" 
      /> 

    <!-- previous button --> 
    <Button 
     android:id="@+id/widget_previous" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="5dp" 
     android:layout_marginBottom="35dp" 
     android:layout_alignParentBottom="true" 
     android:background="@drawable/left_button"/> 

    <!-- Next Button --> 
    <Button 
     android:id="@+id/widget_next" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="5dp" 
     android:layout_marginBottom="35dp" 
     android:layout_alignParentBottom="true" 
     android:background="@drawable/right_button" /> 


    <!-- Indicator --> 

    <LinearLayout 
     android:id="@+id/widget_progressbar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_marginBottom="33dp" 
     android:layout_marginRight="50dp" 
     android:layout_alignParentBottom="true"> 

     <!-- ProgressBar throws exception when it's set invisible from RemoteViews use a layout wrapper instead --> 
     <ProgressBar 
      android:layout_width="15dp" 
      android:layout_height="15dp"> 
     </ProgressBar> 
    </LinearLayout> 

</RelativeLayout> 

Motorola Droid에서이 레이아웃은 적합하지만 다른 장치에서는 ImageView가 아래에 위치합니다. 어떤 도움이나 제안도 환영합니다.

drawable_bg.png는 294x146 픽셀입니다.

  • 하기 Sandeep

답변

1

위젯의 실제 크기는 장치

  • 사용 된 홈 애플리케이션 (서로 다른 알림 바있다의

    • 디스플레이 해상도 (픽셀)에 의존 하단 바)
    • Android OS 버전 (다른 버전에도 다른 홈 앱이 있음)

    "fill_parent"레이아웃과 배경 이미지를 "ninepatch"이미지로 만드는 것이 좋습니다. 다른 디스플레이 해상도 (dpi)에 다른 배경 이미지를 사용하여 배경 이미지가 완벽하게 보이게하십시오.

  • 0

    다른 화면 크기에 맞게 더 많은 레이아웃을 만드는 것을 고려해야하며, 모든 화면 크기에서 위젯이 잘 보이는지 테스트 할 수 있도록 테스트해야한다고 생각합니다.