2016-10-02 30 views
-1

我在导航视图应用样式使用下面的代码有没有办法将主题应用到导航视图的不同项目?

app:theme="@style/NavigationItemTheme" //NavigationItemTheme is my style. 

它适用同样的主题,所有的导航项目。我想将不同的主题应用于不同的项目。如何实现请帮助。

是否有可能将不同的主题应用于导航视图中的不同项目?

回答

0

你的孩子可以添加到您的导航视图并添加样式儿童

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="end" 
    android:background="@color/white" 
    android:fitsSystemWindows="true"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center_horizontal" 
     android:orientation="vertical"/> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center_horizontal" 
     android:orientation="vertical"/> 
</android.support.design.widget.NavigationView> 
+0

它不工作 –

+0

你应该添加样式linearlayouts例如 –

相关问题