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>
    

      就可以看到通知栏变高了

  • 相关阅读:
    CSP_2019
    luogu_P1026 统计单词个数
    [SCOI2007]降雨量
    [HEOI2016/TJOI2016]排序
    LuoguP2698 【[USACO12MAR]花盆Flowerpot】
    LuoguP3069 【[USACO13JAN]牛的阵容Cow Lineup
    CF723D 【Lakes in Berland】
    CF799B T-shirt buying
    迪杰斯特拉算法(Dijkstra) (基础dij+堆优化) BY:优少
    Tarjan求有向图强连通分量 BY:优少
  • 原文地址:https://www.cnblogs.com/leihupqrst/p/9485867.html
Copyright © 2011-2022 走看看