Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put a horizontal divisor line between edit text's in a activity

I'm making an activity to configure my app, and I have to divide the sections of my configuration window with a line. I used this: divider_horizontal_bright, from this example:

http://android.cryx.li/doku.php?id=know:settings:start

However it doesn't work! When I test on my android phone, it doesn't show a horizontal line. Why?

I am using Android 2.1

like image 397
NullPointerException Avatar asked Nov 10 '10 15:11

NullPointerException


People also ask

How do I make a horizontal line in Android?

There are many ways we can add a Horizontal line/rule in an Android Layout. xml file. One of the ways is to create a table row with background color and a height of say 1-2dp.

How do I add a line in Android?

This example demonstrates how do I draw a line in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How do you draw a line on your phone?

quadTo(mX, mY, (x + mX)/2, (y + mY)/2); You will be able to draw straight lines.

What is the vertical line in Android Studio?

That line historically represents the margin of A4 paper, which is useful only if you need to print the code. Old school says that you should keep your code inside that margin, to guarantee much portability.


2 Answers

Try this link.... horizontal rule

That should do the trick.

The code below is xml.

<View     android:layout_width="fill_parent"     android:layout_height="2dip"     android:background="#FF00FF00" /> 
like image 85
prolink007 Avatar answered Oct 22 '22 11:10

prolink007


If this didn't work:

  <ImageView     android:layout_gravity="center_horizontal"     android:paddingTop="10px"     android:paddingBottom="5px"     android:layout_height="wrap_content"     android:layout_width="fill_parent"     android:src="@android:drawable/divider_horizontal_bright" /> 

Try this raw View:

<View     android:layout_width="fill_parent"     android:layout_height="1dip"     android:background="#000000" /> 
like image 40
Cristian Avatar answered Oct 22 '22 11:10

Cristian