set

Android Textview Aligment

Here we are going to see about how to set textview alignment in Android.

It is very simple to set Android textview alignment to the center, right or left etc..

Example for Android textview alignment -

To align a textview we need to use the 'gravity' property

[sourcecode language="xml"]
<TextView android:text="@+id/TextView01"
android:id="@+id/TextView01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center" />
[/sourcecode]

Now we set the alignment to center

Android Text Color

In Android, we can set text color for textview, edittext, buttons, etc...

Example:-

Input

Output

Set icon for title bar in Android

In Android we have the facility to set an icon for the title bar.

In the below image the title bar contains only the title.
Title name is Iconic Memory

To set an icon in the title bar use the below piece of code...

[sourcecode language="java"]
@Override
public void onCreate(Bundle savedInstanceState)

Syndicate content