This can be difficult considering that:

- 2.3 pushed home screen icons down relative to widgets (or was it the
other way around?), except HTC devices, where 2.3 has a lot of 2.1-2.2
elements...
- 4.0  and 4.1 surrounds widgets with additional padding (when it remembers
to, and its memory is not perfect)
- there are replacement launchers
- there are manufacturer-specific launchers

Now you really wanted to get a close match, I'd recommend you look in
Launcher2 sources. However, IIRC, it uses a custom View subclass to render
the shortcuts - something a 3rd party widget can't do (the set of views
that can be used in a widget is limited).

-- K

2012/9/28 Fred Jones <[email protected]>

> I'm having this exact problem.. was anyone ever able to come up with a way
> of doing this that is consistent across different home screens?
>
> It seems like the tCalendar app does it perfectly.
>
> Thanks.
>
> On Friday, October 30, 2009 12:40:59 AM UTC-4, Evan Ruff 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<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/<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/ <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]
> 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

Reply via email to