Great tip Matt! Thanks for sharing! E
On Wed, Nov 11, 2009 at 9:34 AM, Matt Kanninen <[email protected]> wrote: > 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 <[email protected]> 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

