something happened to my app as i cannot place the widget in the Emulator. It says: no more room on this home screen. I tried to modifiy the layout_width parameters but nothing have changed. Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="200px"
android:layout_height="100px"
android:layout_gravity="left"
android:id="@+id/widgetlayout"
android:background="@drawable/blacktrans"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="200px"
android:layout_height="20dip"
android:id="@+id/widgetlayoutinside3"
android:paddingTop="3px"
android:layout_marginLeft="5px"
>
<TextView android:id="@+id/widget_textview3"
android:text="widget_text"
android:layout_height="wrap_content"
android:layout_width="70px"
android:textColor="#FFFFFF"
android:textSize="13sp"
开发者_C百科 android:paddingLeft="15px"
android:layout_gravity="fill_horizontal"
android:layout_marginLeft="5px"
/>
<Button
android:id="@+id/ButtonP3"
android:layout_width="28px"
android:layout_height="28px"
android:layout_toRightOf="@+id/widget_textview3"
android:layout_marginLeft="5px">
</Button>
<Button
android:id="@+id/ButtonS3"
android:layout_width="28px"
android:layout_height="28px"
android:layout_marginLeft="5px"
android:layout_toRightOf="@+id/ButtonP3">
</Button>
<Button
android:id="@+id/ButtonM3"
android:layout_width="28px"
android:layout_height="28px"
android:layout_marginLeft="5px"
android:layout_toRightOf="@+id/ButtonS3">
</Button>
</RelativeLayout>
</RelativeLayout>
If there is too many icon on screen and your widget is so big, you can't place it. I think you must move the icons and make smaller widget.
Read the section about widths for widgets again.
http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#sizes
I'd suggest using a standard size, and trying to see how that works for you.
widget screen sizes are in 80x100y dip in portrait per cell and 106x74y dip in landscape. You need to make sure your widget can either statically conform to that size or be dynamically assigned to it (i.e. fill_parent)
精彩评论