1

I need to know how i can position the Application Name to the center , by default the position is to the left of the screen.

I did refer few tips on alignment but seems to be not working. the position is for the application name and not for individual activity name. Also the need to set a combination of colors to the text of application name which currently i am using the setcolor method .

2 Answers2

1

Here's a way to do it (for the app or activity name in the default bar on the top)

((TextView)getWindow().getDecorView().findViewById(android.R.id.title)).setGravity(Gravity.CENTER);
jeydee
  • 49
  • 3
0

You can do this using xml

<LinearLayout
        android:id="@+id/linear"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/title"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:text="Title" />
    </LinearLayout>
Snehal Poyrekar
  • 735
  • 5
  • 17