Reputation: 877
i need to use an AlertDialog
in my application which reads the contents form a text file. For that i had done as shown in http://bees4honey.com/blog/tutorial/adding-eula-to-android-app/
It really helped me and is a nice tutorial for those who needs help...
But i need the text displayed inside that AlertDialog
as central aligned..
how can i do this?
I had tried for customize dialog... But i cant get it worked.. i had checked many sites for references, but i failed to get a good tutorial. Can anyone describe how to make a custom AlertDialog and how the message inside the dialog can be aligned?
I had written Styles.xml in values
<style name="RightJustifyTextView" parent="@android:style/Widget.TextView">
<item name="android:gravity">right|center_vertical</item>
<item name="android:layout_centerVertical">true</item>
</style>
<style name="RightJustifyDialogWindowTitle" parent="@android:style/DialogWindowTitle">
<item name="android:gravity">right|center_vertical</item>
<item name="android:layout_centerVertical">true</item>
</style>
<style name="RightJustifyTheme" parent="@android:style/Theme.Dialog.Alert">
<item name="android:textViewStyle">@style/RightJustifyTextView</item>
<item name="android:windowTitleStyle">@style/RightJustifyDialogWindowTitle</item>
</style>
</resources>
but the style RightJustifyTextView and RightJustifyTheme shows error..
And i have updated my eula file with
public class RightJustifyAlertDialog extends AlertDialog {
public RightJustifyAlertDialog(Context ctx) {
super(ctx, R.style.RightJustifyTheme); } }
i am not sure what i have done. but just tried to do something like http://s401.codeinspot.com/q/2052397
Step By Step desription will be very helpful for the students who are learning Android programming... looking forward for good descriptive answers..
Upvotes: 0
Views: 1927
Reputation: 11447
See if this helps: http://geekjamboree.wordpress.com/2011/11/19/dialog-vs-alertdialog/
You could set the TextView
with id=@+id/textViewListName
to android:gravity="center_horizontal"
Upvotes: 2