我正在OS 8.1 Oreo的android手机中运行我的android应用,对话似乎没有问题,但是当我安装/构建到android棒棒糖的其他手机时,对话会变形为原始大小。
请参见下图。
Please click for the image (Error design deform)
对话源代码
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.dialogue_dash_date_picker);
final Spinner spinner = dialog.findViewById(R.id.typeViewSpinner);
Button btnDismiss = dialog.findViewById(R.id.btnOK);
String viewType = ViewTypeSingleton.getInstance().getTypeview();
if (viewType.equals(""))
spinner.setSelection(0);
else if (viewType.equals("Day"))
spinner.setSelection(1);
else if (viewType.equals("Week"))
spinner.setSelection(2);
else if (viewType.equals("Month"))
spinner.setSelection(3);
else if (viewType.equals("Year"))
spinner.setSelection(4);
else if (viewType.equals("All"))
spinner.setSelection(5);
btnDismiss.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
String choosen = spinner.getSelectedItem().toString();
ViewTypeSingleton.getInstance().setTypeview(choosen);
message.success(""+choosen,context);
fragmentRedirection(new fragment_main());
}
});
dialog.create();
dialog.show();
请帮助我解决此问题。
谢谢
答案 0 :(得分:0)
将此样式添加到您的sum(str(x).isnumeric() for x in df.columns)
# 8
style.xml
然后像这样创建对话框
<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
</style>
答案 1 :(得分:0)
请尝试通过以下方式设置对话框的高度和宽度:
Dialog dialog = new Dialog(context,android.R.style.Theme_Translucent_NoTitleBar);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.YOUR_LAYOUT);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.CENTER;
dialog.getWindow().setAttributes(lp);
dialog.show();