我在查找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
我已经设置此,在似乎比 “小” 部件更小。基本上,没有人知道它在图片1它不会扩展的部件有什么问题吗?我的代码如下。
1)它的默认状态是什么样子。
2)它看起来什么当另一画面上展开等。
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>
您是否尝试将minHeight添加到根LinearLayout? –