当我展示Android DialogFragment
子类时,我无法隐藏标题栏和徽标。有谁知道怎么做?
答案 0 :(得分:1)
隐藏标题,徽标/图标:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}
为布局提供新的宽度和高度:
@Override
public void onStart() {
int dialogWidth = 800;
int dialogHeight = LayoutParams.WRAP_CONTENT;
Window window = getDialog().getWindow();
window.setLayout(dialogWidth, dialogHeight);
window.setGravity(Gravity.CENTER);
super.onStart();
}
答案 1 :(得分:0)
只需在HelpDialog.onCreateView(...)
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
这样你就明确要求获得一个没有标题的窗口:)
编辑:
LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
myview.setLayoutParams(lp);
layoutparams(widht,height)。得到了吗?