我需要使用以下布局自定义自定义对话框的标题区域:
dialog_title.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/text"
android:text="@string/tell_a_friend"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dip"
android:paddingTop="12dip"
android:paddingBottom="12dip"
style="@style/bigTextWhite" />
</LinearLayout>
我正在使用扩展 Dialog 的 CustomDialog 类创建对话框。
CustomDialog dialogTellAFriend = new CustomDialog(this, Constants.TELL_A_FRIEND_DIALOG);
dialogTellAFriend.show();
我该如何实现这一点?
最佳答案
您必须隐藏对话框标题并通过 xml 填充整个对话框。我认为这个想法最适合您。
隐藏对话框标题
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
并加载对话框的布局
dialog.setContentView(R.layout.logindialog);
关于android - 自定义对话框标题的布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12088783/