这是我的布局的样子:
我有一个父活动,它有一个自定义视图(view1自己处理onTouch事件)和2个按钮(view2和view3). DialogFragment显示了可见的布局,其余部分是透明的.
我的对话框片段如下所示:
public class FragmentText extends DialogFragment{
public static FragmentText newInstance() {
FragmentText frag = new FragmentText();
frag.setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Translucent_NoTitleBar);
return frag;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
// instantiate the custom layout
final View layout = inflater.inflate(R.layout.fragment_layout, null);
.....
}
}
并且布局文件如下所示:
xmlns:tools="http://schemas.android.com/tools"
android