Android浸入式

android tint使用 tint主要是针对图片进行变色,比如有一个条目点击后 右边的小三角行图片变色,获取很常用就是筛选点击后图片变色,使用tint减少了设计师的压力,还有就是我们也少使用图片 这样就减少了apk的大小 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.... 阅读详情

现在比较流行的就是浸入式,也就是状态栏颜色和当前页面颜色保持一致,为了有更好的视觉效果。 首先: 在setContentView()之前加上如下代码 tintManager.setStatusBarTintResource()可以设置想要的通知栏颜色

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setTranslucentStatus(true);
            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setStatusBarTintResource(R.color.app_main_color);//通知栏所需颜色
        }
        setContentView(R.layout.activity_base);

    }

    @TargetApi(19)
    private void setTranslucentStatus(boolean on) {
        Window win = getWindow();
        WindowManager.LayoutParams winParams = win.getAttributes();
        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
        if (on) {
            winParams.flags |= bits;
        } else {
            winParams.flags &= ~bits;
        }
        win.setAttributes(winParams);
    }

效果图

SystemBarTintManager类附在下面

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout.LayoutParams;

import java.lang.reflect.Method;

/**
 * Class to manage status and navigation bar tint effects when using KitKat
 * translucent system UI modes.
 *
 */
public class SystemBarTintManager {

    static {
        // Android allows a system property to override the presence of the navigation bar.
        // Used by the emulator.
        // See https://github.com/android/platform_frameworks_base/blob/master/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#L1076
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            try {
                Class c = Class.forName("android.os.SystemProperties");
                Method m = c.getDeclaredMethod("get", String.class);
                m.setAccessible(true);
                sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys");
            } catch (Throwable e) {
                sNavBarOverride = null;
            }
        }
    }


    /**
     * The default system bar tint color value.
     */
    public static final int DEFAULT_TINT_COLOR = 0x99000000;

    private static String sNavBarOverride;

    private final SystemBarConfig mConfig;
    private boolean mStatusBarAvailable;
    private boolean mNavBarAvailable;
    private boolean mStatusBarTintEnabled;
    private boolean mNavBarTintEnabled;
    private View mStatusBarTintView;
    private View mNavBarTintView;

    /**
     * Constructor. Call this in the host activity onCreate method after its
     * content view has been set. You should always create new instances when
     * the host activity is recreated.
     *
     * @param activity The host activity.
     */
    @TargetApi(19)
    public SystemBarTintManager(Activity activity) {

        Window win = activity.getWindow();
        ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            // check theme attrs
            int[] attrs = {android.R.attr.windowTranslucentStatus,
                    android.R.attr.windowTranslucentNavigation};
            TypedArray a = activity.obtainStyledAttributes(attrs);
            try {
                mStatusBarAvailable = a.getBoolean(0, false);
                mNavBarAvailable = a.getBoolean(1, false);
            } finally {
                a.recycle();
            }

            // check window flags
            WindowManager.LayoutParams winParams = win.getAttributes();
            int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
            if ((winParams.flags & bits) != 0) {
                mStatusBarAvailable = true;
            }
            bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
            if ((winParams.flags & bits) != 0) {
                mNavBarAvailable = true;
            }
        }

        mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable);
        // device might not have virtual navigation keys
        if (!mConfig.hasNavigtionBar()) {
            mNavBarAvailable = false;
        }

        if (mStatusBarAvailable) {
            setupStatusBarView(activity, decorViewGroup);
        }
        if (mNavBarAvailable) {
            setupNavBarView(activity, decorViewGroup);
        }

    }

    /**
     * Enable tinting of the system status bar.
     *
     * If the platform is running Jelly Bean or earlier, or translucent system
     * UI modes have not been enabled in either the theme or via window flags,
     * then this method does nothing.
     *
     * @param enabled True to enable tinting, false to disable it (default).
     */
    public void setStatusBarTintEnabled(boolean enabled) {
        mStatusBarTintEnabled = enabled;
        if (mStatusBarAvailable) {
            mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * Enable tinting of the system navigation bar.
     *
     * If the platform does not have soft navigation keys, is running Jelly Bean
     * or earlier, or translucent system UI modes have not been enabled in either
     * the theme or via window flags, then this method does nothing.
     *
     * @param enabled True to enable tinting, false to disable it (default).
     */
    public void setNavigationBarTintEnabled(boolean enabled) {
        mNavBarTintEnabled = enabled;
        if (mNavBarAvailable) {
            mNavBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * Apply the specified color tint to all system UI bars.
     *
     * @param color The color of the background tint.
     */
    public void setTintColor(int color) {
        setStatusBarTintColor(color);
        setNavigationBarTintColor(color);
    }

    /**
     * Apply the specified drawable or color resource to all system UI bars.
     *
     * @param res The identifier of the resource.
     */
    public void setTintResource(int res) {
        setStatusBarTintResource(res);
        setNavigationBarTintResource(res);
    }

    /**
     * Apply the specified drawable to all system UI bars.
     *
     * @param drawable The drawable to use as the background, or null to remove it.
     */
    public void setTintDrawable(Drawable drawable) {
        setStatusBarTintDrawable(drawable);
        setNavigationBarTintDrawable(drawable);
    }

    /**
     * Apply the specified alpha to all system UI bars.
     *
     * @param alpha The alpha to use
     */
    public void setTintAlpha(float alpha) {
        setStatusBarAlpha(alpha);
        setNavigationBarAlpha(alpha);
    }

    /**
     * Apply the specified color tint to the system status bar.
     *
     * @param color The color of the background tint.
     */
    public void setStatusBarTintColor(int color) {
        if (mStatusBarAvailable) {
            mStatusBarTintView.setBackgroundColor(color);
        }
    }

    /**
     * Apply the specified drawable or color resource to the system status bar.
     *
     * @param res The identifier of the resource.
     */
    public void setStatusBarTintResource(int res) {
        if (mStatusBarAvailable) {
            mStatusBarTintView.setBackgroundResource(res);
        }
    }

    /**
     * Apply the specified drawable to the system status bar.
     *
     * @param drawable The drawable to use as the background, or null to remove it.
     */
    @SuppressWarnings("deprecation")
    public void setStatusBarTintDrawable(Drawable drawable) {
        if (mStatusBarAvailable) {
            mStatusBarTintView.setBackgroundDrawable(drawable);
        }
    }

    /**
     * Apply the specified alpha to the system status bar.
     *
     * @param alpha The alpha to use
     */
    @TargetApi(11)
    public void setStatusBarAlpha(float alpha) {
        if (mStatusBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            mStatusBarTintView.setAlpha(alpha);
        }
    }

    /**
     * Apply the specified color tint to the system navigation bar.
     *
     * @param color The color of the background tint.
     */
    public void setNavigationBarTintColor(int color) {
        if (mNavBarAvailable) {
            mNavBarTintView.setBackgroundColor(color);
        }
    }

    /**
     * Apply the specified drawable or color resource to the system navigation bar.
     *
     * @param res The identifier of the resource.
     */
    public void setNavigationBarTintResource(int res) {
        if (mNavBarAvailable) {
            mNavBarTintView.setBackgroundResource(res);
        }
    }

    /**
     * Apply the specified drawable to the system navigation bar.
     *
     * @param drawable The drawable to use as the background, or null to remove it.
     */
    @SuppressWarnings("deprecation")
    public void setNavigationBarTintDrawable(Drawable drawable) {
        if (mNavBarAvailable) {
            mNavBarTintView.setBackgroundDrawable(drawable);
        }
    }

    /**
     * Apply the specified alpha to the system navigation bar.
     *
     * @param alpha The alpha to use
     */
    @TargetApi(11)
    public void setNavigationBarAlpha(float alpha) {
        if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            mNavBarTintView.setAlpha(alpha);
        }
    }

    /**
     * Get the system bar configuration.
     *
     * @return The system bar configuration for the current device configuration.
     */
    public SystemBarConfig getConfig() {
        return mConfig;
    }

    /**
     * Is tinting enabled for the system status bar?
     *
     * @return True if enabled, False otherwise.
     */
    public boolean isStatusBarTintEnabled() {
        return mStatusBarTintEnabled;
    }

    /**
     * Is tinting enabled for the system navigation bar?
     *
     * @return True if enabled, False otherwise.
     */
    public boolean isNavBarTintEnabled() {
        return mNavBarTintEnabled;
    }

    private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
        mStatusBarTintView = new View(context);
        LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
        params.gravity = Gravity.TOP;
        if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
            params.rightMargin = mConfig.getNavigationBarWidth();
        }
        mStatusBarTintView.setLayoutParams(params);
        mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
        mStatusBarTintView.setVisibility(View.GONE);
        decorViewGroup.addView(mStatusBarTintView);
    }

    private void setupNavBarView(Context context, ViewGroup decorViewGroup) {
        mNavBarTintView = new View(context);
        LayoutParams params;
        if (mConfig.isNavigationAtBottom()) {
            params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight());
            params.gravity = Gravity.BOTTOM;
        } else {
            params = new LayoutParams(mConfig.getNavigationBarWidth(), LayoutParams.MATCH_PARENT);
            params.gravity = Gravity.RIGHT;
        }
        mNavBarTintView.setLayoutParams(params);
        mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
        mNavBarTintView.setVisibility(View.GONE);
        decorViewGroup.addView(mNavBarTintView);
    }

    /**
     * Class which describes system bar sizing and other characteristics for the current
     * device configuration.
     *
     */
    public static class SystemBarConfig {

        private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
        private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";
        private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";
        private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";
        private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";

        private final boolean mTranslucentStatusBar;
        private final boolean mTranslucentNavBar;
        private final int mStatusBarHeight;
        private final int mActionBarHeight;
        private final boolean mHasNavigationBar;
        private final int mNavigationBarHeight;
        private final int mNavigationBarWidth;
        private final boolean mInPortrait;
        private final float mSmallestWidthDp;

        private SystemBarConfig(Activity activity, boolean translucentStatusBar, boolean traslucentNavBar) {
            Resources res = activity.getResources();
            mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
            mSmallestWidthDp = getSmallestWidthDp(activity);
            mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME);
            mActionBarHeight = getActionBarHeight(activity);
            mNavigationBarHeight = getNavigationBarHeight(activity);
            mNavigationBarWidth = getNavigationBarWidth(activity);
            mHasNavigationBar = (mNavigationBarHeight > 0);
            mTranslucentStatusBar = translucentStatusBar;
            mTranslucentNavBar = traslucentNavBar;
        }

        @TargetApi(14)
        private int getActionBarHeight(Context context) {
            int result = 0;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                TypedValue tv = new TypedValue();
                context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
                result = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
            }
            return result;
        }

        @TargetApi(14)
        private int getNavigationBarHeight(Context context) {
            Resources res = context.getResources();
            int result = 0;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                if (hasNavBar(context)) {
                    String key;
                    if (mInPortrait) {
                        key = NAV_BAR_HEIGHT_RES_NAME;
                    } else {
                        key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME;
                    }
                    return getInternalDimensionSize(res, key);
                }
            }
            return result;
        }

        @TargetApi(14)
        private int getNavigationBarWidth(Context context) {
            Resources res = context.getResources();
            int result = 0;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                if (hasNavBar(context)) {
                    return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
                }
            }
            return result;
        }

        @TargetApi(14)
        private boolean hasNavBar(Context context) {
            Resources res = context.getResources();
            int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");
            if (resourceId != 0) {
                boolean hasNav = res.getBoolean(resourceId);
                // check override flag (see static block)
                if ("1".equals(sNavBarOverride)) {
                    hasNav = false;
                } else if ("0".equals(sNavBarOverride)) {
                    hasNav = true;
                }
                return hasNav;
            } else { // fallback
                return !ViewConfiguration.get(context).hasPermanentMenuKey();
            }
        }

        private int getInternalDimensionSize(Resources res, String key) {
            int result = 0;
            int resourceId = res.getIdentifier(key, "dimen", "android");
            if (resourceId > 0) {
                result = res.getDimensionPixelSize(resourceId);
            }
            return result;
        }

        @SuppressLint("NewApi")
        private float getSmallestWidthDp(Activity activity) {
            DisplayMetrics metrics = new DisplayMetrics();
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
            } else {
                activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
            }
            float widthDp = metrics.widthPixels / metrics.density;
            float heightDp = metrics.heightPixels / metrics.density;
            return Math.min(widthDp, heightDp);
        }

        /**
         * Should a navigation bar appear at the bottom of the screen in the current
         * device configuration? A navigation bar may appear on the right side of
         * the screen in certain configurations.
         *
         * @return True if navigation should appear at the bottom of the screen, False otherwise.
         */
        public boolean isNavigationAtBottom() {
            return (mSmallestWidthDp >= 600 || mInPortrait);
        }

        /**
         * Get the height of the system status bar.
         *
         * @return The height of the status bar (in pixels).
         */
        public int getStatusBarHeight() {
            return mStatusBarHeight;
        }

        /**
         * Get the height of the action bar.
         *
         * @return The height of the action bar (in pixels).
         */
        public int getActionBarHeight() {
            return mActionBarHeight;
        }

        /**
         * Does this device have a system navigation bar?
         *
         * @return True if this device uses soft key navigation, False otherwise.
         */
        public boolean hasNavigtionBar() {
            return mHasNavigationBar;
        }

        /**
         * Get the height of the system navigation bar.
         *
         * @return The height of the navigation bar (in pixels). If the device does not have
         * soft navigation keys, this will always return 0.
         */
        public int getNavigationBarHeight() {
            return mNavigationBarHeight;
        }

        /**
         * Get the width of the system navigation bar when it is placed vertically on the screen.
         *
         * @return The width of the navigation bar (in pixels). If the device does not have
         * soft navigation keys, this will always return 0.
         */
        public int getNavigationBarWidth() {
            return mNavigationBarWidth;
        }

        /**
         * Get the layout inset for any system UI that appears at the top of the screen.
         *
         * @param withActionBar True to include the height of the action bar, False otherwise.
         * @return The layout inset (in pixels).
         */
        public int getPixelInsetTop(boolean withActionBar) {
            return (mTranslucentStatusBar ? mStatusBarHeight : 0) + (withActionBar ? mActionBarHeight : 0);
        }

        /**
         * Get the layout inset for any system UI that appears at the bottom of the screen.
         *
         * @return The layout inset (in pixels).
         */
        public int getPixelInsetBottom() {
            if (mTranslucentNavBar && isNavigationAtBottom()) {
                return mNavigationBarHeight;
            } else {
                return 0;
            }
        }

        /**
         * Get the layout inset for any system UI that appears at the right of the screen.
         *
         * @return The layout inset (in pixels).
         */
        public int getPixelInsetRight() {
            if (mTranslucentNavBar && !isNavigationAtBottom()) {
                return mNavigationBarWidth;
            } else {
                return 0;
            }
        }

    }

}

最后加入 android:fitsSystemWindows="true"必然显示不完整会被覆盖

加群:Android进阶群 4112676   可免费获取Android进阶资料

Android沉浸模式详解Demo Android沉浸模式详解Demo Android Immersive Mode 立即下载

相关推荐

Android的几种沉浸式方式

根据郭神关于沉浸式方式的博客所总结的Android的几种沉浸式方式

Android使用tint实现Drawable着色

Android使用tint实现Drawable着色一、目标二、体验地址三、功能设计四、实现方案五、组合起来1. 定义Drawable资源2. 定义分组颜色3. 定义内置标签4. TagViewHolder六、Finally 一、目标 二、体验地址 神马笔记最新版本下载:【神马笔记 版本1.6.0——标签功能.apk】 三、功能设计 标签包含2个信息——颜色和名称,通过颜色可以直观地显示标签的含义...

济沧海 x 远沧溟 3565

Android 沉浸式状态栏(亲测好用)

Android 沉浸式状态栏,包括普通沉浸式与图片沉浸式,亲测好用!

Android面试题

1.Service启动方式 startService ①.定义一个类继承service ②.在manifest.xml文件中配置该service ③.使用context的startService(intent)启动该service ④.不再使用时,调用stopService(Intent)停止该服务 bindService ①.创建bindService服务段,继承自service并在类中,创建.........

最美的路百转千回 1885

Android轻松实现沉浸式/透明式状态栏

轻松实现沉浸式/透明式状态栏,有纯色,透明状态栏,适配4.4和5.0及以上版本

杰理的蓝牙芯片的key是什么?以及该如何添加key?杰理key文件原理

很多的工程师,在开发杰理蓝牙芯片的第一步就会有一个很深的疑惑,关于key的 1、什么是key文件? 2、Key文件是如何产生的? 3、为什么需要他key文件? 4、如何添加key文件? 5、以及实际开发中的一些报错该如何处理?

qyvhome的博客 4094

android 浸入式布局,Android中浸入式状态栏的使用

###前言在Android开发过程中,我们为了让界面ui更美化的话,会涉及到浸入式状态栏的问题。我将此功能封装到两个类:- StatusBarUtil 头部状态栏处理类- NavigationBarUtil 底部按键栏处理类那么,今天就让我们来讲讲浸入式状态栏相关知识吧。今天涉及内容:1. `StatusBarUtil`与`NavigationBarUtil`主要方法简介1.1 `StatusB...

weixin_34614674的博客 535

DDR内存接口深度解析:从寻址机制到FPGA时序约束实战

在高速数字系统设计中,内存接口是决定系统性能与稳定性的关键。DDR(双倍数据速率)技术通过在时钟的上升沿和下降沿传输数据,实现了带宽的倍增,广泛应用于消费电子、通信设备和工控主板等领域。其核心原理在于利用三维存储阵列(Bank、Row、Column)的分级寻址机制,通过先进行行激活、再进行列访问的固定时序,实现高速数据吞吐。理解这一寻址顺序是进行精准时序分析的基础。在工程实践中,FPGA作为内存控制器,需通过严谨的时序约束(如set_input_delay)来确保信号在高速传输下的建立与保持时间要求,从而将

weixin_29192211的博客 196

android 浸入式 android:fitsSystemWindows

1、android:fitsSystemWindows 默认为false 2、android:fitsSystemWindows 设为true时,设置全屏后无效,因为设置了android:fitsSystemWindows=true的最外层ViewGroup的被系统设置了paddingTop="状态栏高度" 3、android:fitsSystemWindows需要设置在ViewGroup视图里,设置在非ViewGroup视图无效 4、父的ViewGroup设置了android:fitsSystemW

Hly的博客 1063

全志V3S开发板实战:从零构建嵌入式Linux系统

本文提供了一份针对全志V3S开发板(如LicheePi Zero)的零基础教程,详细指导如何从零开始构建嵌入式Linux系统。内容涵盖编译环境搭建、交叉工具链配置、U-Boot引导程序编译与烧录、Linux内核定制与编译,以及使用Buildroot构建根文件系统,最终实现系统成功启动,帮助开发者深入理解嵌入式系统构建全流程。

tensor9flow的博客 574

高德地图 搜索和点击定位

高德地图vue

weixin_45474673的博客 1943

android中侵入式标题,Android中浸入式状态栏的使用

前言在Android开发过程中,我们为了让界面ui更美化的话,会涉及到浸入式状态栏的问题。我将此功能封装到两个类:StatusBarUtil 头部状态栏处理类NavigationBarUtil 底部按键栏处理类那么,今天就让我们来讲讲浸入式状态栏相关知识吧。今天涉及内容:StatusBarUtil与NavigationBarUtil主要方法简介1.1 StatusBarUtil方法简介1.2 N...

weixin_42100188的博客 379

【数学建模】编程手学习路线

在学习过程中,建议注重理论与实践相结合,多进行实例练习和项目实践,以巩固所学知识并提升实际应用能力。同时,保持对新技术和新方法的关注和学习,不断提升自己的专业素养和竞争力。NumPy、Pandas、Matplotlib和Seaborn等库是数据处理和可视化的重要工具。掌握常用机器学习算法的原理和应用,如决策树、支持向量机、神经网络等。学习内容包括微积分、线性方程组、矩阵运算、概率分布、统计推断等。学习内容包括基本语法、函数和模块、面向对象编程、文件操作等。深入了解优化理论和方法,如梯度下降法、牛顿法等。

2301_79586491的博客 2960

Android 4.4跟Android 5.0浸入式状态栏的实现

What:浸入式状态栏作为一个非常优秀的设计方案受到大家的热捧,Android为了迎合趋势,也添加了浸入式状态栏。但是Android4.4系统是市场占有率使得我们必需在Android 4.4上面也要实现浸入式。

MoriatyHe的博客 820

3.7 改造模型:为GPT添加一个分类头(Classification Head)

本文介绍如何改造GPT模型用于文本分类任务。主要内容包括: 分类头设计思路:GPT作为语言模型需要添加分类头才能适应分类任务,类似于为语言大师添加裁判功能。 序列表示选择策略: 分析三种常见方法(CLS标记、平均池化、最后词元表示) 推荐使用最后词元表示,因其最能反映GPT的单向信息流特性 代码实现: 构建GPT2ForSequenceClassification类 包含预训练GPT主体和线性分类头 使用attention_mask智能定位句子结尾 通过高级索引提取最后词元特征 该方法通过简单改造使GPT模

yonggeit的博客 2968

PCL 最小生成树用于法向量定向【2025最新版】

PCL 最小代价生成树用于点云法向量的定向。博客长期更新,本文最近更新时间为:2025年9月15日。

点云侠的博客 2067

Android实现activity内嵌fragment时状态栏浸入式

1.概述开发遇到浸入式  有时候也挺头疼的  新公司开发又遇到浸入式的问题了  于是研究了一下  完成了需求  记录一下浸入式其实就是状态栏半透明的效果 能够在页面滑动的时候状态栏背景和页面的背景一致2.效果图这里就是浸入式的效果了  值得一提的是  浸入式的透明效果在 华为等部分手机上不是全透明的  就像下面 有个明显的半透明色值3.实现浸入式首先先看我给的样式&lt;style name="A...

you_everything的博客 3409

从0开始图形学(光栅化)

从0开始图形学

A112459的专栏 2395

Android浸入式轮子

项目地址:BarLibrary 偷个懒 直接把README.md的内容拿来。 使用kotlin造的一个小小的轮子。 一边学习Kotlin一边利刚学的kotlin造个一个小小的轮子,该轮子就是设置StatusBar和NavigationBar的背景颜色/透明和图标颜色,没错就是所谓的浸入式。 怎么使用? override fun onCreate(savedInstance

yukun314的专栏 472

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Android 浸入式标题栏

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // 透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } 要注意的是,不要将状态栏设为白色,因为Android的状态栏图标和文字是白色的,而且API

hello_12413的专栏 5212

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

android 沉浸式状态栏_Android浸入式

现在比较流行的就是浸入式,也就是状态栏颜色和当前页面颜色保持一致,为了有更好的视觉效果。 首先: 在setContentView()之前加上如下代码 tintManager.setStatusBarTintResource()可以设置想要的通知栏颜色@Override protected void onCreate(Bundle savedInstanceState) { super.onC...

weixin_39650994的博客 126

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

android 浸入式布局,Android在代码中设置沉浸式布局的方法

先导入该包,进行 系统systemBar 管理compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'在BaseActivity中添加 该 字段;public class BaseActivity extends Activity{@Overrideprotected void onCreate(Bundle savedI...

weixin_33764387的博客 388

ToolBar与AppcompatAcitivity实现浸入式Statusbar效果

toolbar是android sdk API21新增的组件,下面是谷歌官方的介绍文档: A standard toolbar for use within application content. A Toolbar is a generalization of action bars for use within application layouts. While a

【博客地址迁移到】:https://zhengxiaoyong.com 2366

android HorizontalProgressBarWithNumber, android 自定义pm横线分割线控件(非浸入式)绿,棕,红

public class HorizontalProgressBarWithNumber extends ProgressBar { private static final int DEFAULT_TEXT_SIZE = 10; private static final int DEFAULT_TEXT_COLOR = 0XFFFC00D1; private stati...

疾风剑豪 910

CoordinatorLayout 上的一些布局技巧

CoordinatorLayout是一个“加强版”的 FrameLayout,它主要有两个用途: (1) 用作应用的顶层布局管理器 (2) 通过为子View指定 behavior 实现自定义的交互行为。 在我们做 Material Design 风格的app时通常都使用 CoordinatorLayout 作为布局的根节点,以便实现特定的UI交互行为。 那么现在我们来看看如何用已有的一些控件实...

qq_43093708的博客 2029
上一篇: Android 混淆问题排查
下一篇: Android SurfaceView
动脑学院[David]
博客等级 码龄8年 44粉丝 31原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值