简体   繁体   English

用户切换字体和背景颜色

[英]user toggle the font and background color

I have an app with 25 activities and in one activity I want to let the user choose the all app fond colour and back_ground colour and buttons colour how can I do it我有一个包含 25 个活动的应用程序,在一个活动中我想让用户选择所有应用程序喜欢的颜色和背景颜色和按钮颜色我该怎么做

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".art_first_activity">

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="478dp"
        android:text="art1"
        android:textColor="@color/purple_200"
        android:textSize="20dp" />

    <RadioGroup
        android:id="@+id/group1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true">

        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="500">

        </RadioButton>

        <RadioButton
            android:id="@+id/radio_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="600">

        </RadioButton>

        <RadioButton
            android:id="@+id/radio3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="700">

        </RadioButton>
    </RadioGroup>

    <Button
        android:id="@+id/button_next"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_marginEnd="92dp"
        android:layout_marginRight="92dp"
        android:layout_marginBottom="158dp"
        android:onClick="nat"
        android:text="next" />
</RelativeLayout>

I have alot of buttons and edittext which I have to let the user change its color + back ground color in all activities我有很多按钮和edittext,我必须让用户在所有活动中更改其颜色+背景颜色

You can set programmatically all this things.您可以以编程方式设置所有这些内容。 Need to create Global variable or you can use sharedpreference for this.需要创建全局变量,或者您可以为此使用 sharedpreference。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM