Skip to content

Commit

Permalink
feat(gradle): 约束dialog宽度
Browse files Browse the repository at this point in the history
  • Loading branch information
hss01248 committed Oct 13, 2023
1 parent a254afc commit f4cd2c0
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package androidx.appcompat.app;

import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.hss01248.aop.alertdialog.R;
import com.hss01248.dialog.ScreenUtil;
import com.hss01248.dialog.StyledDialog;
import com.hss01248.dialog.Tool;
import com.hss01248.dialog.adapter.SuperLvHolder;
Expand Down Expand Up @@ -136,7 +139,14 @@ public void onItemClick(CharSequence text, int position) {
dialog.setView(holder0.rootView);

dialog.setCancelable(params.mCancelable);

dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog0) {
WindowManager.LayoutParams attributes = dialog.getWindow().getAttributes();
attributes.width = (int) (ScreenUtil.getWindowManager().getDefaultDisplay().getWidth() * 0.8f);
dialog.getWindow().setAttributes(attributes);
}
});


//dialog.getWindow().setGravity(builder.);
Expand Down

0 comments on commit f4cd2c0

Please sign in to comment.