Android中让Dialog全屏: 
一、在style中定义样式: 

<?xml version="1.0" encoding="utf-8"?>  
<resources>  
    <style name="Transparent">    
    <item name="android:windowBackground">@color/transparent_background</item>    
    <item name="android:windowNoTitle">true</item>    
    <item name="android:windowFullscreen">true</item>  
    <item name="android:windowIsTranslucent">true</item>       
    <item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>    
  </style>  
</resources>  

 

 


其中transparent_background为颜色值:#50000000,透明度为50 

二、代码中定义Dialog时添加样式: 

View myLoginView = LayoutInflater.from(mContext).inflate(R.layout.activity_answer_category, null);
ListView cList = (ListView) myLoginView.findViewById(R.id.cagetoryList);
cList.setAdapter(new Adapter());
alertDialog = new Dialog(mContext, R.style.Transparent);
alertDialog.setContentView(myLoginView);
alertDialog.show();

 

相关文章:

  • 2021-08-02
  • 2021-12-25
  • 2021-11-09
  • 2021-06-25
  • 2022-02-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2021-11-10
  • 2021-08-01
相关资源
相似解决方案