#How to Implement Dark Theme Model applied in android st
Explore tagged Tumblr posts
Text
How to Implement Dark Theme Model applied in android studio
https://ift.tt/2xkIGNu
Dark Theme Model applied
we need a few files I.values > 1. attrs.xml 2. colors.xml 3. styles.xml 4. themes.xml II.values-night > 2. themes.xml ____________________________________________ attrs.xml ____________________________________________ <!-- Toolbar --> <attr name="toolbarBackground" format="color"/> <attr name="toolbarTitle" format="color"/> ____________________________________________ colors.xml ____________________________________________ <color name="whitethree">#F0F0F0</color> <color name="black">#222222</color> <color name="blacktwo">#151515</color> <color name="graylabel">#8B8B8B</color> <color name="warmgray">#737373</color> <color name="red">#F7000B</color> ____________________________________________ styles.xml ____________________________________________ <style name="ToolBarStyle"> <item name="android:textSize">16sp</item> <item name="android:background">?toolbarBackground</item> <item name="android:textColor">?toolbarTitle</item> </style> ____________________________________________ themes.xml ____________________________________________ <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <!-- Customize your theme here. --> <item name="toolbarBackground">@color/sunfloweryellow</item> <item name="toolbarTitle">@color/white</item> </style> </resources> ____________________________________________ values-night[themes.xml] ____________________________________________ <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <item name="toolbarBackground">@color/colorPrimaryDark</item> <item name="toolbarTitle">@color/ttu_black</item> </style> </resources> ____________________________________________ implementation ____________________________________________ <androidx.appcompat.widget.AppCompatTextView android:id="@+id/txt_hello" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" style="@style/ToolBarStyle" android:textSize="@android:dimen/app_icon_size" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" />
via Blogger https://ift.tt/2RMwsq3
0 notes