我想删除Top of custom对话框

时间:2017-09-20 05:25:16

标签: android dialog customdialog

我想在自定义对话框中删除浅紫色线...

在自定义对话框中,它有两个TextView,一个ImageView和一个Button。

关于用户个人资料,如果点击按钮,则可以编辑个人资料。

我不知道是什么问题。purple line

我该如何解决这个问题?

my_profile_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="@dimen/dialog_height"
android:background="@color/whiteback">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:gravity="center|bottom"
    android:paddingTop="@dimen/padding_20dp"
    android:paddingLeft="@dimen/padding_20dp"
    android:paddingRight="@dimen/padding_20dp">
    <ImageView
        android:id="@+id/dialog_imageIv"
        android:src="@drawable/logo"
        android:layout_width="@dimen/logoSize"
        android:layout_height="@dimen/logoSize" />
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:gravity="center"
    android:padding="@dimen/padding_15dp"
    android:orientation="vertical">
    <TextView
        android:id="@+id/dialog_nameTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="이름"
        android:textStyle="bold"
        android:textSize="@dimen/btn_16dp"
        android:layout_marginBottom="@dimen/padding_5dp"/>
    <TextView
        android:id="@+id/dialog_emailTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="asmwj3@naver.com"/>
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.5">
    <Button
        android:id="@+id/dialog_editBtn"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/click_action"
        android:text="@string/profileEdit"
        android:textColor="@color/white"
        android:textStyle="bold"/>
</LinearLayout>

MyProfileCustomDialog.java

public class MyProfileCustomDialog extends Dialog {
public RequestManager mRequestManager;

private ImageView dialog_myProfileIv;
private TextView dialog_myProfileNameTv, dialog_myProfileEmailTv;
private Button dialog_myProfileEditBtn;
private Context mContext;

private String userEmail, userName, userImage;

public MyProfileCustomDialog(@NonNull Context context, String userName, String userEmail, String userImage, RequestManager requestManager) {
    super(context);
    this.mContext = context;
    this.userEmail = userEmail;
    this.userName = userName;
    this.userImage = userImage;
    this.mRequestManager = requestManager;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    WindowManager.LayoutParams lpWindow = new WindowManager.LayoutParams();
    lpWindow.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    lpWindow.dimAmount = 0.8f;
    getWindow().setAttributes(lpWindow);

    setContentView(R.layout.my_profile_dialog);

    dialog_myProfileIv = (ImageView)findViewById(R.id.dialog_imageIv);
    dialog_myProfileEmailTv = (TextView)findViewById(R.id.dialog_emailTv);
    dialog_myProfileNameTv = (TextView)findViewById(R.id.dialog_nameTv);
    dialog_myProfileEditBtn = (Button)findViewById(R.id.dialog_editBtn);

    dialog_myProfileEmailTv.setText(userEmail);
    dialog_myProfileNameTv.setText(userName);

    mRequestManager
            .load(Uri.parse(userImage))
            .centerCrop()
            .crossFade()
            .bitmapTransform(new CropCircleTransformation(new CustomBitmapPool()))
            .signature(new StringSignature(String.valueOf(System.currentTimeMillis())))
            .override(200,200)
            .into(dialog_myProfileIv);

    dialog_myProfileEditBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(mContext, EditUserActivity.class);
            mContext.startActivity(i);
        }
    });
}

}

,我这样使用..

FragmentSecond.java

MyProfileCustomDialog customDialog = new MyProfileCustomDialog(getContext(), userName, userEmail, userImage, mRequestManager);
customDialog.show();

2 个答案:

答案 0 :(得分:0)

尝试使用 requestWindowFeature(Window.FEATURE_NO_TITLE); 隐藏对话框标题

您可以使用以下方式隐藏对话框的标题:

customDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

答案 1 :(得分:0)

您可以为自定义对话框定义新样式,并更改所有样式属性,例如文本外观,背景颜色和文本颜色。因此,在Style.xml文件中将项添加到应用程序的主题中,如下面的代码:

<style name="AppTheme" parent="AppBaseTheme">

    <item name="android:dialogTheme">@style/alertdialog</item>
</style>


<style name="alertdialog">

    <item name="android:textColor">@android:color/your color</item>
    <item name="android:fontFamily">your font</item>
    <item name="android:textStyle">your text style</item>
</style>