Simple View Question

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

Simple View Question

Postby xdm87 » Sun Jan 10, 2010 1:14 am

I want to make this simple horizontal line view within Java using the API. How would I do that?

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <View android:layout_width="fill_parent" android:layout_height="1dp" android:background="?android:attr/listDivider" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


I have this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. View hl = new View(this);
  2.  
  3. hl.setBackgroundResource(android.R.attr.listDivider);
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


..but I'm not sure how to set layout_width to fill_parent and layout_height to 1dp.

Thanks
xdm87
Freshman
Freshman
 
Posts: 4
Joined: Tue Jan 05, 2010 6:19 am

Top

Re: Simple View Question

Postby jagtap.jj1 » Mon Jan 11, 2010 8:36 am

Which layout r u using?
To set layout params use "LayoutParams" class,
Each layout having corresponding LayoutParams class,
e.g. LinearLayout.LayoutParams: http://developer.android.com/reference/ ... arams.html
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 9 guests