0

Possible Duplicate:
How to align center the title or label in activity?

Simple question, I have made a dialogbox with a label at the top. The label has for some reason gravity left as default, and I want to change it to center. The label is defined in my AndroidManifest.xml file as :

<b>activity</B> 
        android:name=".WelcomeDialog" 
        android:theme="@android:style/Theme.Dialog"
        android:label="@string/welcome_dialog_title"
        >

<b>/activity></B> 

I have tried to put android:gravity="center" but it is not working, any tips how to solve this issue?

Thx in advance!

Community
  • 1
  • 1
jesmar
  • 11
  • 1
  • 4

1 Answers1

1

just put the code under the setContentView(R.layout.new)...

((TextView)((FrameLayout)((LinearLayout)((ViewGroup) getWindow().getDecorView()).getChildAt(0)).getChildAt(0)).getChildAt(0)).setGravity(Gravity.CENTER);

To be very frank this code is copied from another stackoverflow question: How to align center the title or label in activity?

I am sure it can help you mate!!!!

;)

Community
  • 1
  • 1
necixy
  • 4,964
  • 5
  • 38
  • 54