Android Widget看起来与启动器图标完全相同

时间:2015-08-25 19:20:55

标签: android android-layout widget android-widget android-launcher

我在使用小部件时遇到困难。从http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#cellstable读取下表:

  • 1个细胞 - 40dp
  • 2 cell - 110dp
  • ...
  • n cell - 70×n - 30 dp

所以我想看作发射器的小部件它的minHeigth和minWidth为40dp。到目前为止,我所做的是使用图标作为启动器,192px,144px,96px,72px和48px。

但我无法获得作为图标发射器的确切感觉(文字风格,动人风格......)。我可以尝试猜测但是......在哪里可以找到启动器布局的源代码?我找不到它。与其他图标相比,看看小部件的外观如何:

enter image description here

我想尝试的另一件事是制作绿色图标以填充所有单元格(作为背景),然后填充另一个图像和文本。我也不能让它看起来很好,我想知道唯一的方法是在这里使用9patch图像...

到目前为止,这是我的小部件布局代码:

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

  <ImageView
    android:id="@+id/appwidget_button"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_gravity="center_horizontal"
    android:layout_weight="1"
    android:src="@drawable/widget_1_background"/>

  <TextView
    android:id="@+id/appwidget_text"
    android:typeface="sans"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:textColor="@android:color/white"
    android:textSize="12sp"
    android:singleLine="true"/>

</LinearLayout>

建议?

0 个答案:

没有答案