How-to-underline-textview-in-android

If you want to underline TextView in Android you can use this code:

        SpannableString contentUnderline = new SpannableString("some text here");
        contentUnderline.setSpan(new UnderlineSpan(), 0, contentUnderline.length(), 0);
        TextView TextViewCopyright = (TextView) findViewById(R.id.TextView01);
        TextViewCopyright.setText(contentUnderline);


Special thanks to Eli.

Posted in Android, Java at March 21st, 2011. 1 Comment.

How to show copyright symbol in textview

If you want to show copyright symbol © in the TextView, you can use the Unicode character for this: “\u00A9”

    <string name="copyright">\u00A9 2011 copyright</string>

or to use ©

    <string name="copyright">&#169; 2011 copyright</string>
Posted in Android, Java at March 20th, 2011. No Comments.

Android multi line EditText

Today I will show how to create multi line EditText field in your android application.Let’s first create a EditText field:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
	<EditText
	    android:text="EditText01"
	    android:id="@+id/EditText01"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:lines="5">
	</EditText>
</LinearLayout>

Now add this android:lines=”5″

	    android:text="EditText01"
	    android:id="@+id/EditText01"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:lines="5">

And the result should be a multi line edit text.

As you can see the image the text is in the middle, let’s move it on the top of the EditText. Insert this row

android:gravity="top"

and voala, the text is on the top of the EditText.

Posted in Android, Java, Layout at March 13th, 2011. 1 Comment.