gpt4 book ai didi

安卓 : Dialog occupy 100% width

转载 作者:行者123 更新时间:2023-11-29 14:19:40 26 4
gpt4 key购买 nike

 final Dialog dialog = new Dialog(this, R.style.theme_dialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_name);
dialog.setCancelable(false);

dialog.getWindow().setGravity(Gravity.TOP);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

上面的代码占据了大约 90% 的宽度,但我想要 100%。

最佳答案

添加以下样式

<style name="Theme_Dialog" parent="android:Theme.Holo.Dialog">
<item name="android:windowMinWidthMajor">100%</item>
<item name="android:windowMinWidthMinor">100%</item>
</style>

final Dialog dialog = new Dialog(getActivity(), R.style.Theme_Dialog);

关于安卓 : Dialog occupy 100% width,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40756208/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com