2016-03-03 35 views
0

不工作这是我在布局按钮主题在DialogFragment

<android.support.v7.widget.AppCompatButton 
      android:id="@+id/positive_btn" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="50" 
      android:text="@string/submit_btn_text" 
      android:theme="@style/PrimaryRoundedButton" 
      tools:style="@style/PrimaryRoundedButton"/> 

而这里的PrimaryRoundedButton风格

<style name="PrimaryRoundedButton" parent="Widget.AppCompat.Button.Colored"> 
    <item name="android:colorButtonNormal">@color/primary_button_color</item> 
    <item name="colorButtonNormal">@color/primary_button_color</item> 
    <item name="colorControlHighlight">@color/white</item> 
</style> 

安卓主题不能正常使用,风格的作品,但纹波当它应该是白色的时候是黄色的。相同的主题是在正常的片段中工作,但不是dialogFragment。

+0

请参阅[this](http://stackoverflow.com/questions/26422292/how-to-style-buttons-in-alert-dialog-fragment-using-material-design)文章,让我们知道! –

+0

@SaumikBhattacharya我不使用正面/负面的按钮,但有我自己的布局,谢谢反正 –

回答

0

好了,所以我在我的BaseDialogFragment作为

setStyle(STYLE_NO_FRAME, android.R.style.Theme_Light_NoTitleBar); 

设置风格我改成了

setStyle(STYLE_NO_FRAME, R.style.FullDialog); 

哪里FullDialog是

<style name="FullDialog" parent="Theme.AppCompat.Light"> 
     <item name="android:windowNoTitle">true</item> 
     <item name="android:windowFullscreen">true</item> 
     <item name="android:windowIsFloating">false</item> 
</style> 

所以现在我有一个全屏幕的对话框带有适当主题的按钮。