dynamic height of custom view

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

dynamic height of custom view

Postby purvi » Wed Oct 21, 2009 3:33 pm

Hello,

I have a custom class that extends view class. Now this custom view is set in the listadapter that extends baseadapter. Along with the custom view I have a TextView in the list. So the xml i inflate for list view is
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <LinearLayout>
  3.  
  4.     <my.customview ..../>
  5.  
  6.     <TextView .../>
  7.  
  8. </LinearLayout>
  9.  
  10.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

the customview sets a rounded rectangle behind the text in TextView.
Now The height of the textview vary as per its content. So I want the height of the customview also vary as per the height of TextView. How can I achieve this? Can anyone please help me out with this? This is really urgent.

Thanks.
Regards,
Purvi
purvi
Junior Developer
Junior Developer
 
Posts: 10
Joined: Mon Oct 19, 2009 2:52 pm

Top

Re: dynamic height of custom view

Postby jagtap.jj1 » Fri Oct 23, 2009 6:40 am

Make the custom view as parent of text view and height of custom view equals "wrap_content"

purvi wrote:Hello,

I have a custom class that extends view class. Now this custom view is set in the listadapter that extends baseadapter. Along with the custom view I have a TextView in the list. So the xml i inflate for list view is
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <LinearLayout>
  2.     <my.customview ..../>
  3.     <TextView .../>
  4. </LinearLayout>
  5.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

the customview sets a rounded rectangle behind the text in TextView.
Now The height of the textview vary as per its content. So I want the height of the customview also vary as per the height of TextView. How can I achieve this? Can anyone please help me out with this? This is really urgent.

Thanks.
Regards,
Purvi
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests