我有一個android.support.v4.app.DialogFragment,它顯示時,高度是最大,但是widht只是包裝內容,我需要設置自定義高度,android android.support.v4.app.DialogFragment設置大小
我已經嘗試過這樣的:
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
getDialog().getWindow().setLayout(2000, 2000);
super.onViewCreated(view, savedInstanceState);
}
但結果總是相同的
EDIT1
這裏是XML佈局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:minHeight="10000dp"
android:minWidth="10000dp" >
.......content
</RelativeLayout>
EDIT2
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.marche_charts, container, false);
WindowManager.LayoutParams wmlp = getDialog().getWindow().getAttributes();
wmlp.gravity = Gravity.CENTER;
wmlp.height = 2000;
wmlp.width = 2000;
getDialog().getWindow().setAttributes(wmlp);
return view;
}
類似的問題和答案[here](http://stackoverflow.com/questions/12478520/how-to-set-dialogfragments-width-and-height)或[here](http:// stackoverflow。 com/questions/14946887/setting-the-size-of-a-dialogfragment) – gunar