how do I center a label i android? [duplicate]
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!
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!!!!
;)
精彩评论