张钢
2024-09-02 63608b5dca9eebb6fa2cb1a8652b395f1d910c3e
app/src/main/java/com/application/zhangshi_app_android/other/MyTitleBarStyle.java
@@ -6,11 +6,9 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.widget.TextView;
import androidx.appcompat.content.res.AppCompatResources;
import com.android.app_base.utils.ScreenSizeUtils;
import com.application.zhangshi_app_android.R;
import com.hjq.bar.style.CommonBarStyle;
@@ -38,7 +36,10 @@
    @Override
    public Drawable getTitleBarBackground(Context context) {
        return new ColorDrawable(context.getColor(R.color.color_title_bar_background));
        //根据当前主题获取不同的背景颜色
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(R.attr.titleBarBackgroundColor, typedValue, true);
        return new ColorDrawable(typedValue.data);
    }
    @Override