• RemoteView设置高度


    刚开始内层LinearLayout直接用

    android:layout_height="match_parent"
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@color/black"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:layout_width="match_parent"
        android:layout_height="64dp">
    
        <LinearLayout
            android:id="@+id/layout_home"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <ImageView
                android:id="@+id/btn_home"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:src="@mipmap/ic_notification_bar_home"/>
    
            <TextView
                android:id="@+id/tv_home"
                android:textColor="@color/white"
                android:text="@string/noti_home"
                android:textSize="@dimen/sp_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    
    
        <ImageView
            android:background="#ffffff"
            android:alpha="0.2"
            android:layout_width="@dimen/dp_0_5"
            android:layout_height="@dimen/dp_28"/>
    
        <LinearLayout
            android:id="@+id/layout_junk"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <ImageView
                android:id="@+id/btn_junk"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:background="@mipmap/ic_notification_bar_junk"/>
    
            <TextView
                android:id="@+id/tv_junk"
                android:text="@string/noti_junk"
                android:textSize="@dimen/sp_12"
                android:textColor="@color/white"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
    
        </LinearLayout>
    
        <ImageView
            android:background="#ffffff"
            android:alpha="0.2"
            android:layout_width="@dimen/dp_0_5"
            android:layout_height="@dimen/dp_28"/>
    
        <LinearLayout
            android:id="@+id/layout_boost"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <ImageView
                android:id="@+id/img_boost"
                android:layout_width="24dp"
                android:layout_height="24dp" />
    
            <TextView
                android:id="@+id/tv_boost"
                android:textColor="@color/white"
                android:text="@string/noti_boost"
                android:textSize="@dimen/sp_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    
        <ImageView
            android:background="#ffffff"
            android:alpha="0.2"
            android:layout_width="@dimen/dp_0_5"
            android:layout_height="@dimen/dp_28"/>
    
    
        <LinearLayout
            android:id="@+id/layout_cpu"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <FrameLayout
                android:layout_width="24dp"
                android:layout_height="24dp">
    
                <ImageView
                    android:id="@+id/btn_cpu"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@mipmap/ic_notification_bar_cpu"/>
    
                <ImageView
                    android:id="@+id/cpu_warn_icon"
                    android:visibility="invisible"
                    android:src="@mipmap/img_cpu_warn"
                    android:layout_gravity="bottom|right"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
    
            </FrameLayout>
    
    
    
            <TextView
                android:id="@+id/tv_cpu"
                android:textColor="@color/white"
                android:text="@string/noti_cpu"
                android:textSize="@dimen/sp_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    
    </LinearLayout>
    

    后来改成这样:

    内层LinearLayout设置为:android:layout_height="64dp"

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@color/black"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:layout_width="match_parent"
        android:layout_height="64dp">
    
        <LinearLayout
            android:id="@+id/layout_home"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="64dp">
    
            <ImageView
                android:id="@+id/btn_home"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:src="@mipmap/ic_notification_bar_home"/>
    
            <TextView
                android:id="@+id/tv_home"
                android:textColor="@color/white"
                android:text="@string/noti_home"
                android:textSize="@dimen/sp_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    
    
        <ImageView
            android:background="#ffffff"
            android:alpha="0.2"
            android:layout_width="@dimen/dp_0_5"
            android:layout_height="@dimen/dp_28"/>
    
        <LinearLayout
            android:id="@+id/layout_junk"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <ImageView
                android:id="@+id/btn_junk"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:background="@mipmap/ic_notification_bar_junk"/>
    
            <TextView
                android:id="@+id/tv_junk"
                android:text="@string/noti_junk"
                android:textSize="@dimen/sp_12"
                android:textColor="@color/white"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
    
        </LinearLayout>
    
        <ImageView
            android:background="#ffffff"
            android:alpha="0.2"
            android:layout_width="@dimen/dp_0_5"
            android:layout_height="@dimen/dp_28"/>
    
        <LinearLayout
            android:id="@+id/layout_boost"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <ImageView
                android:id="@+id/img_boost"
                android:layout_width="24dp"
                android:layout_height="24dp" />
    
            <TextView
                android:id="@+id/tv_boost"
                android:textColor="@color/white"
                android:text="@string/noti_boost"
                android:textSize="@dimen/sp_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    
        <ImageView
            android:background="#ffffff"
            android:alpha="0.2"
            android:layout_width="@dimen/dp_0_5"
            android:layout_height="@dimen/dp_28"/>
    
    
        <LinearLayout
            android:id="@+id/layout_cpu"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <FrameLayout
                android:layout_width="24dp"
                android:layout_height="24dp">
    
                <ImageView
                    android:id="@+id/btn_cpu"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@mipmap/ic_notification_bar_cpu"/>
    
                <ImageView
                    android:id="@+id/cpu_warn_icon"
                    android:visibility="invisible"
                    android:src="@mipmap/img_cpu_warn"
                    android:layout_gravity="bottom|right"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
    
            </FrameLayout>
    
    
    
            <TextView
                android:id="@+id/tv_cpu"
                android:textColor="@color/white"
                android:text="@string/noti_cpu"
                android:textSize="@dimen/sp_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    
    </LinearLayout>
    

      就可以看到通知栏变高了

  • 相关阅读:
    Hibernate_条件查询客户列表
    Hibernate_添加联系人练习
    Linux目录的切换
    CentOS6.5在VMware中安装
    一个关于vue+mysql+express的全栈项目(三)------ 登录注册功能的实现(已经密码安全的设计)
    一个关于vue+mysql+express的全栈项目(二)------ 前端构建
    基于vue实现模糊匹配(这里以邮箱模糊匹配为例,其他的模糊匹配都可以类比)
    一个关于vue+mysql+express的全栈项目(一)
    关于Google浏览器Unable to preventDefault inside passive event listener due to target being treated as passive.的解决方案
    在移动端H5开发中(关于安卓端position:fixed和position:absolute;和虚拟键盘冲突的问题,以及解决方案)
  • 原文地址:https://www.cnblogs.com/leihupqrst/p/9485867.html
Copyright © 2020-2023  润新知