当前布局
我有一个与 xml 布局相关的问题,并且我不知道如何添加主色和主深色。有人可以帮助我吗?
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>
它应该是什么样子
最佳答案
您应该在值文件夹中修改或创建文件 styles.xml(如果它不存在),如下所示:
<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>
它从colors.xml 文件中获取值。
关于android - 如何更改primary和primaryDark颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33315857/