zoukankan      html  css  js  c++  java
  • 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>
    

      就可以看到通知栏变高了

  • 相关阅读:
    磁盘阵列监控
    Docker-PS命令解析
    .NET编程周记第3期-2020年1月19日
    Microsoft Ignite The Tour Beijing 记录: Learn Connect Explore
    使用TryGetComponent取代GetComponent以避免Editor中的内存分配
    向.Net/Unity 程序员推荐一个十分因吹斯听的网站:sharplab.io
    Unity AR Foundation 和 CoreML: 实现手部的检测和追踪
    如何使用Android Studio在安卓平台对Unity开发的应用进行性能检查?
    Unity的Mesh压缩:为什么我的内存没有变化?
    Unity User Group深圳站——Timeline & Cinemachine分享
  • 原文地址:https://www.cnblogs.com/leihupqrst/p/9485867.html
Copyright © 2011-2022 走看看