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

Fer*_*gre 11 android widget android-widget android-layout android-launcher

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

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

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

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

在此输入图像描述

我想尝试的另一件事是制作绿色图标以填充所有单元格(作为背景),然后填充另一个图像和文本.我也不能让它看起来不错,我想知道唯一的方法是在这里使用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>
Run Code Online (Sandbox Code Playgroud)

建议?