How to draw a line using XML tag

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

How to draw a line using XML tag

Postby nithin.warier » Thu Mar 13, 2008 11:23 am

i tried using stroke tag.. using the below statements

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <shape xmlns:android="http://schemas.android.com/apk/res/android" type="line    ">
  2.  
  3.     <stroke  android:width="1dp"
  4.  
  5.             android:height="10dp"  
  6.  
  7.             android:color="#FFFFFFFF"
  8.  
  9.             android:dashWidth="1dp"
  10.  
  11.             android:dashGap="2dp" />
  12.  
  13.     <size android:height="100dp" />
  14.  
  15. </shape>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


but its showing like a rectangular box.. i just want to draw a line

any suggestions..

thanks
Nithin
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Top

Postby Jesmiatka » Thu Mar 13, 2008 11:54 am

Hi,

it will be a line if you fill it with a color ;-)
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Postby nithin.warier » Thu Mar 13, 2008 1:29 pm

<TextView android:id = "@+id/textview0"
android:background="@drawable/line"
android:layout_width="200px"
android:layout_height="30px"
android:text = "Let Us C"/>
the line in drawable is
<shape xmlns:android="http://schemas.android.com/apk/res/android" type="line ">
<stroke android:width="1dp"
android:height="1dp"
android:color="#FFFFFFFF"
android:dashWidth="1dp"
android:dashGap="2dp" />
<size android:height="1dp" />
</shape>

when i put any other color than white(FFFFFFFF) , nothing is comg..

thanks
Nithin
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Postby mcjam24 » Wed Aug 05, 2009 3:50 am

You may have found this already..but you can try doing something like...

Code: Select all
<View
         android:layout_width="fill_parent"
         android:layout_height="2dip"
         android:background="#FF909090" />


I've tried it with a few colour codes and its worked for me.....
mcjam24
Freshman
Freshman
 
Posts: 2
Joined: Wed Aug 05, 2009 3:38 am

Postby mcjam24 » Wed Aug 05, 2009 3:51 am

You may have found this already..but you can try doing something like...

Code: Select all
<View
         android:layout_width="fill_parent"
         android:layout_height="2dip"
         android:background="#FF909090" />


I've tried it with a few colour codes and its worked for me.....
mcjam24
Freshman
Freshman
 
Posts: 2
Joined: Wed Aug 05, 2009 3:38 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: Google [Bot] and 4 guests