How to change primary and primaryDark color?
11,933
You should modify, or create if it didn't exists already the file styles.xml, in the values folder, like that :
<style name="MyMaterialTheme.Base" >
<!-- Primary Color -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="colorAccent">@color/colorAccent</item>
</style>
It gets it's values from colors.xml file.
Author by
Yakuza
Updated on June 04, 2022Comments
-
Yakuza almost 2 years
current layout
I have a problem related to xml layout, and I don't know how to add primary and primary dark color. Can anybody help me?
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/in" android:layout_width="match_parent" android:layout_height="match_parent" android:stackFromBottom="true" android:transcriptMode="alwaysScroll" android:layout_weight="1"/> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/edit_text_out" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="bottom"/> <Button android:id="@+id/button_send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send"/> </LinearLayout> </LinearLayout>
How it should look like