Android 앱을 개발 중입니다. 내 응용 프로그램에서 사용자 지정보기를 설정하는 경고 대화 상자를 표시하려고합니다. 사용자 정의보기 설정은 정상입니다. 하지만 대화 상자의 너비 설정에 문제가 있습니다. 너비를 설정할 수 없습니다. 그것은 항상 기본값입니다. 아래의 시나리오를 참조하십시오.Android에서 사용자 정의 대화 상자의 너비를 설정할 수 없습니다.
이 내가 당신은 내가 100dp 할 수있는 폭을 설정할 볼 수 있듯이
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View view = layoutInflater.inflate(R.layout.meme_post_actions_dialog,null);
builder.setView(view);
builder.create().show();
대화 이것은 XML 레이아웃
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:orientation="vertical" android:layout_width="100dp"
android:layout_height="match_parent">
<TextView
android:text="This is dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
입니다 보여주는 방법이다. 그래서 너비가 너무 작습니다. 그러나 이것이 내가 가진 것입니다.
어떻게 사용자 지정 경고 대화의 폭을 설정할 수 있습니까?
안녕하세요, 와이 연의 하인이가 you.http 데 도움이 링크를 희망하려고 @ : //stackoverflow.com/questions/12478520/how-to-set- dialogfragments-width-and-height –