Applying style to drawable textview

I have a layout for a TextView and popped as such ...

<LinearLayout style="@style/dashboard_content_horizontal" >

    <ImageView
        style="@style/dashboard_imageview"
        android:src="@drawable/menu6" />

    <TextView
        style="@style/dashboard_textview"
        android:text="@string/menu6_text />

</LinearLayout> 

as you can see the image uses a style attribute that looks like

<style name="dashboard_imageview">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">fill_parent</item>
    <item name="android:layout_weight">1</item>
    <item name="android:scaleType">fitCenter</item>
</style>

the line layout style surrounding it is as follows

<style name="dashboard_content_horizontal">
    <item name="android:layout_width">0px</item>
    <item name="android:layout_height">fill_parent</item>
    <item name="android:layout_weight">3</item>
    <item name="android:orientation">vertical</item>
    <item name="android:layout_gravity">center</item>
    <item name="android:gravity">center</item>
</style>

and TextView style

<style name="dashboard_textview">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:gravity">center</item>
    <item name="android:textSize">20sp</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textColor">@color/black</item>
</style>

it all works and looks the way I want it to look. however, because of this eclipse warning, "This tag and its children can be replaced by one and multiple," I decided to try to do this only with TextView and drawable

as such..

<TextView  
    android:layout_marginTop="10dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:text="Menu6" 
    android:drawableBottom="@drawable/my_drawable"
    android:padding="5dp" />

this makes the image too small. I don’t see a way to apply style to an image to get it as if I want to. Does anyone know the answer? maybe even?

+3
source share

All Articles