clamp
clamp

Reputation: 34036

android: format textview

is it possible to format a textview for a widget so that it looks like the text below the apps.

like in this screenshot:

alt text

i am looking for the exact textcolor, the exact dropshadow and the rounded background.

Upvotes: 0

Views: 1135

Answers (1)

Jerry Brady
Jerry Brady

Reputation: 3079

When in doubt, check with the source, which shows that Android is using a custom TextView to implement the bubbled background around the text.

It appears that the text itself is styled using styles in the launcher app:

<style name="WorkspaceIcon">
    <item name="android:textSize">13dip</item>
    <item name="android:singleLine">true</item>
    <item name="android:ellipsize">marquee</item>
    <item name="android:shadowColor">#FF000000</item>
    <item name="android:shadowRadius">2.0</item>
    <item name="android:textColor">#FFF</item>
    <item name="android:gravity">center_horizontal</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">match_parent</item>
    <item name="android:background">@drawable/shortcut_selector</item>
    <item name="android:paddingLeft">5dip</item>
    <item name="android:paddingRight">5dip</item>
</style>

<style name="WorkspaceIcon.Portrait">
    <item name="android:drawablePadding">5dip</item>
    <item name="android:paddingTop">4dip</item>
    <item name="android:layout_marginLeft">3dip</item>
    <item name="android:layout_marginRight">3dip</item>
    <item name="android:layout_marginTop">13dip</item>
    <item name="android:layout_marginBottom">8dip</item>
</style>

<style name="WorkspaceIcon.Landscape">
    <item name="android:drawablePadding">3dip</item>
    <item name="android:paddingTop">2dip</item>
    <item name="android:layout_marginLeft">10dip</item>
    <item name="android:layout_marginRight">10dip</item>
</style>

Those styles are called from the launcher's layouts as appropriate.

Upvotes: 2

Related Questions