[android-developers] Re: Widget Layout Frustration
When I'm 2px off I find negative layout margins help immensely.
http://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html
On Oct 29, 8:40 pm, Evan Ruff <evan.r...@gmail.com> wrote:
> Hey Guys,
>
> I was hoping someone could help me with a home screen widget I'm
> trying to layout. Basically, I'm trying to layout my widget so it
> matched a standard home screen application shortcut perfectly.
> Basically, at this point, I'm about ~2px off and it's driving me
> crazy! Has anyone gotten this to match up juuuuust right? Should I be
> able to find this layout in the source somewhere? Any clues would be
> much appreciated. Here's my layout thus far:
>
> drawable/text_border.xml - For the black background around the text:
> <shape xmlns:android="http://schemas.android.com/apk/res/android">
> <solid android:color="#99000000"/>
> <padding android:left="5dp" android:right="5dp"
> android:bottom="1dp" android:top="1dp" />
> <corners android:radius="7dp" />
> </shape>
>
> layout/widget.xml - The widget itself:
> <?xml version="1.0" encoding="utf-8"?>
> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:layout_gravity="center"
> >
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
> android:orientation="vertical"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_gravity="center"
> >
> <ImageView android:id="@+id/icon"
> android:layout_gravity="center"
> android:src="@drawable/icon_gray"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:paddingBottom="5px"
> android:paddingTop="5px"
> />
> <TextView android:id="@+id/message"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:background="@drawable/text_border"
> android:textColor="#FFFFFFFF"
> android:layout_gravity="center"
> android:text="Assistant"
> android:textSize="12px"
> />
> </LinearLayout>
> </FrameLayout>
>
> Thanks for any help tuning this badboy.
>
> Thanks!
>
> Evan
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home