java - Why am I getting Dark theme when I have declared it to be light? -
i'm developing app material design.
i have added toolbar activity & have set it's theme light here: app:popuptheme="@style/themeoverlay.appcompat.light"
, still i'm getting dark theme after running it.
here's activity_about.xml file's code:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.abc.xyz.aboutactivity"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/themeoverlay.appcompat.light"/> </relativelayout>
here's aboutactivity.java file's code:
public class aboutactivity extends appcompatactivity { toolbar toolbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_about); spannablestring s = new spannablestring("about"); s.setspan(new typefacespan(this, "pacifico.ttf"), 0, s.length(), spannable.span_exclusive_exclusive); toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); getsupportactionbar().setdisplayhomeasupenabled(true); getsupportactionbar().settitle(s); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_about, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } }
here's styles.xml file's code:
<resources> <!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <!-- customize theme here. --> </style> <style name="mymaterialtheme" parent="mymaterialtheme.base"> </style> <style name="mymaterialtheme.base" parent="theme.appcompat.light.darkactionbar"> <item name="windownotitle">true</item> <item name="windowactionbar">false</item> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent">@color/coloraccent</item> </style> </resources>
i'm new material design & hence don't know do.
please let me know.
i'm new stackoverflow, please cooperate.
thanks in advance.
you have change xml apptheme.
<android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways" app:theme="@style/themeoverlay.material.light.actionbar" app:popuptheme="@style/themeoverlay.appcompat.light"/>
Comments
Post a Comment