Click here to Skip to main content
16,008,942 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to create style for linear layout which includes 2 image view, 1 text view with background image.

Please reply with an example as i'm new to android
Posted

1 solution

you can use a separate xml file, say for example, "styles.xml", and put your styles in it. For example, the content of the styles.xml will be:

<resources>
    <style name="sample_style">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:orientation">horizontal</item>
        <item name="android:background">@drawable/samplebackground</item>
    </style>
    
    <style name="sample_style2">
      !-- ....
    </style>
</resources>

and assign it to the image view:
<imageview>
   style="@style/sample_style"
   android:src="@drawable/ic_launcher"
/>
</imageview>


hope this helps...:-)
 
Share this answer
 
Comments
ks ravi 10-Apr-12 1:01am    
thanks for the reply.I want like a style which includes 2 image view,1 text view.please reply with an example

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900