2012-11-28 3 views
3

Android 4.2에 도입 된 잠금 화면 위젯에 대한 참조를 찾는 데 많은 어려움을 겪고 있습니다.잠금 화면 위젯이 너무 작음

나는 런처에서 잘 작동하는 위젯을 만들었으며 예상 한대로 크기가 조정되었습니다. 그러나이 위젯을 잠금 화면에 올리면 올바르게 수직으로 크기가 조정되지 않습니다. 위젯이 같은 수직 크기 조정 자체를 표시하는 경우

http://developer.android.com/guide/topics/appwidgets/index.html#lockscreen에 따르면 그 다음 위젯 높이가 표시 세로 전화에 "작은"으로 표시됩니다, 당신은 android:resizeMode="vertical"

설정하면 수직으로 사용할 수있는 크기를 차지합니다 UI 잠금 해제. 다른 모든 경우 위젯 크기는 사용 가능한 높이를 채 웁니다.

또한 제가 http://developer.android.com/guide/practices/ui_guidelines/widget_design.html

타일에 기재된 정립> 크기를 사용

  • 1> 40dp
  • 2> 110dp
  • 3> 180dp
  • 4> 250dp
  • ...> ...
  • N> 70 × N - 30

나는이 설정 한과에서는 "작은"위젯보다 더 작게 나타납니다. 기본적으로, 사람이 위젯에 무엇이 잘못되었는지 알고 있습니까? image 1 확장되지 않습니다. 내 코드는 아래와 같습니다.

1) 기본 상태로 표시됩니다. 또 다른 화면에 확장 할 때 보이는 무엇

enter image description here

2). 이것은 단지 에뮬레이터에서 일어나는처럼

enter image description here

XML/clock_widget.xml

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" 
    android:initialKeyguardLayout="@layout/clock_widget" 
    android:initialLayout="@layout/clock_widget" 
    android:minHeight="110dp" 
    android:minWidth="180dp" 
    android:resizeMode="vertical" 
    android:updatePeriodMillis="1000" 
    android:widgetCategory="keyguard|home_screen" > 

</appwidget-provider> 

레이아웃/clock_widget.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/clock_widget" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/widget_hour" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textSize="36sp" /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text=":" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textSize="36sp" /> 

     <TextView 
      android:id="@+id/widget_minute" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textSize="36sp" /> 

    </LinearLayout> 

    <TextView 
     android:id="@+id/widget_date" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:text="" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 
</LinearLayout> 
+0

minHeight를 루트 LinearLayout에 추가하려고 했습니까? –

답변

1

보인다. 실제 하드웨어에 대한 테스트가 정상적으로 작동합니다.

+0

글쎄, 내 위젯과 Genymotion 가상 장치 에서이 문제를 본 사람과 비슷한 configuracion와 스마트 폰과 사람에게 물어와 문제가 지속됩니다. "실제 하드웨어"라고 할 때 어떤 전화에 대해 이야기하고 있습니까? –

+0

Galaxy Nexus, Nexus 4, Nexus 7에서는 잘 작동합니다. Galaxy Nexus – Kirk

+0

이상한 구성의 에뮬레이터에서는 작동하지 않았습니다 ... 모든 기기에 재고 런처가 제공됩니다. 당신은 위젯이 항상 이미지 2에있는 것처럼 보이고 있다고 말하는가?AFAIK 초기 화면은 세로 폰의 경우 작고 자물쇠를 아래로 스 와이프하면 펼쳐집니다. –