2015-09-07 85 views
0

現在的對話框看起來是這樣的:如何擺脫對話框中的水平邊距?

enter image description here

但我想是這樣的:

what I want is this

這意味着對話框必須處於水平match_parent。任何人都知道如何做到這一點?

+0

通這個主題R.style .me_Translucent_NoTitleBar對話框構造函數.. – TheFlash

+0

親愛的你使用show dialog.measns你使用Alert DIalog顯示對話框 –

回答

0

您岑使用此代碼

  dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     dialog.setContentView(R.layout.mydialog2); 
     getWindow().setLayout(LayoutParams.FILL_PARENT, 240dp); 

,你可以像自定義樣式:

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

享受您的代碼:)