android layout_width 代码,关于LinearLayout设置权重后width或height不设置0dp的影响说明...

本文围绕Android开发中LinearLayout布局权重问题展开。在“掌上平桂”项目新闻多图展示时,出现图片空间分配不均情况。经排查,发现是LinearLayout布局中ImageView标签width和height设为wrap_content且同时设权重导致权重不生效,将width改为0dp后问题解决。

一.摘要

平时没那么注意LinearLayout布局时权重的问题,设置了权重属性后,通常建议将width或height的属性值设置为0dp,有时候设置权重后,还是习惯将width或height的属性设置为wrap_content,这会有什么影响吗?做完了“掌上平桂”项目后,发现新闻栏目的多图展示,总是出现三张图无法平均分配空间的问题,其中一个原因,每一张图片的尺寸不同,最初的猜想可能网络加载数据延时的问题或是ViewHolder类的问题。最后发现原因是权重设置的问题。

二.多张图布局设计

使用RelativeLayout布局,嵌套垂直的LinearLayout,LinearLayout嵌套TextView和另一个水平的LinearLayout,水平的LinearLayout放置三张图片,最初水平的LinearLayout代码如下:

android:id="@+id/external_news_horizontal_ll"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="horizontal" >

android:id="@+id/news_list_item_img_one_iv"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1"

android:contentDescription="@string/display_news"

android:layout_marginRight="@dimen/hot_news_img_list_left"

android:src="@drawable/default_bg"

android:scaleType="centerCrop"/>

android:id="@+id/news_list_item_img_two_iv"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1"

android:contentDescription="@string/display_news"

android:layout_marginRight="@dimen/hot_news_img_list_left"

android:scaleType="centerCrop"

android:src="@drawable/default_bg"/>

android:id="@+id/news_list_item_img_three_iv"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1"

android:contentDescription="@string/display_news"

android:layout_marginRight="@dimen/hot_news_img_list_left"

android:src="@drawable/default_bg"

android:scaleType="centerCrop"/>

网络加载多图请求后,在BaseAdapter适配器中填充获取的图片 内容后,出现多张图片分配不均匀的情况,但部分图片分配是均匀的,这就让TeachCourse感觉更奇怪,布局中设置的权重都一样的,适配时为什么有的三张图占的空间不一样。

1a4e7ea51b000da3b0bd403941eb18be.png

通常,遇到一个问题,搁在心里TeachCourse觉得挺难受,根据编程的感觉,可以肯定某个地方的代码是有问题的,否则不会出现这种情况。昨晚,第一感觉应该是BaseAdapter使用ViewHolder设置标签的问题,本来是直接写:

mViewHolder.imageView.setImageBitmap();

改成了

ImageView imageView=mViewHolder.imageView;

imageView.setImageBitmap();

认为获取是对象赋值的问题导致的,第二种可能网络加载图片数据的问题,测试后发现还是一样,后来查看了一下布局文件,如上述布局代码

最大的可能,出现在了LinearLayout布局中ImageView标签设置width和height的问题,上述代码中每个ImageView设置的width和height都为wrap_content,同时都设置权重1,似乎不起作用。于是尝试将权重去掉,发现三张图的,最后只显示两张,基本空间都是分配不均匀,看来问题大概明确,权重设置不合理,将width设置的wrap_content改为0dp,修改后的代码:

android:id="@+id/external_news_horizontal_ll"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="horizontal" >

android:id="@+id/news_list_item_img_one_iv"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:contentDescription="@string/display_news"

android:layout_marginRight="@dimen/hot_news_img_list_left"

android:src="@drawable/default_bg"

android:scaleType="centerCrop"/>

android:id="@+id/news_list_item_img_two_iv"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:contentDescription="@string/display_news"

android:layout_marginRight="@dimen/hot_news_img_list_left"

android:scaleType="centerCrop"

android:src="@drawable/default_bg"/>

android:id="@+id/news_list_item_img_three_iv"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:contentDescription="@string/display_news"

android:layout_marginRight="@dimen/hot_news_img_list_left"

android:src="@drawable/default_bg"

android:scaleType="centerCrop"/>

PS:水平的LinearLayout布局,设置权重,width应该设置0dp;垂直的LinearLayout布局,设置权重,height应该设置0dp,否则可能出现width或height分配不均匀的情况,最终原因权重设置不生效。

b6d1b1374586fa0dad51d96e4ea5e9b4.png

布局调整前后,加载网络图片展示,明显区别

700845870eac814840de633b88ca004e.png

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="match_parent" app:cardCornerRadius="8dp"> <!-- 数据卡片 --> <GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="2" android:padding="16dp" > <!-- 左侧网格(第一列) --> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <!-- 属性名 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="电机状态:" android:textStyle="bold" /> <View android:id="@+id/djStateO" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerVertical="true" android:layout_marginRight="8dp" android:background="@drawable/circle_red" /> <!-- 属性值 --> <TextView android:id="@+id/djState" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="未使能" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <!-- 属性名 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="遥控器状态:" android:textStyle="bold" /> <View android:id="@+id/ykqStateO" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerVertical="true" android:layout_marginRight="8dp" android:background="@drawable/circle_red" /> <!-- 属性值 --> <TextView android:id="@+id/ykqState" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="在线" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <!-- 属性名 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="防撞条状态:" android:textStyle="bold" /> <View android:id="@+id/fztStateO" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerVertical="true" android:layout_marginRight="8dp" android:background="@drawable/circle_green" /> <TextView android:id="@+id/fztState" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="无撞击" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <!-- 属性名 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="球蓝状态:" android:textStyle="bold" /> <View android:id="@+id/qlStateO" android:layout_width="18dp" android:layout_height="18dp" android:layout_centerVertical="true" android:layout_marginRight="8dp" android:background="@drawable/circle_green" /> <TextView android:id="@+id/qlState" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="未满" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <!-- 属性名 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SOC:" android:textStyle="bold" /> <TextView android:id="@+id/soc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="%" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="电压:" android:textStyle="bold" /> <TextView android:id="@+id/voltage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="V" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="电流:" android:textStyle="bold" /> <TextView android:id="@+id/electricity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="A" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="车身状态:" android:textStyle="bold" /> <TextView android:id="@+id/carState" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="正常" android:layout_marginRight="8dp" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="左电机转速:" android:textStyle="bold" /> <TextView android:id="@+id/lMotorSpeed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="右电机转速:" android:textStyle="bold" /> <TextView android:id="@+id/rMotorSpeed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="遥控器左电机速度:" android:textStyle="bold" /> <TextView android:id="@+id/lYkqMotorSpeed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="遥控器右电机速度:" android:textStyle="bold" /> <TextView android:id="@+id/rYkqMotorSpeed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_columnWeight="1" android:orientation="horizontal" android:layout_marginBottom="8dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="报文:" android:textStyle="bold" /> <TextView android:id="@+id/txt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="8dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> </GridLayout> </androidx.cardview.widget.CardView> </LinearLayout> 这是我的安卓xml代码,我现在发现左边一行的数据过宽会影响到右边的数据,怎么修改,才能让数据过宽的时候自动换行,影响整体一边一半的布局
11-25
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/bg_light" tools:context=".ui.activity.ServiceCategoryActivity"> <!-- 顶部状态栏占位 --> <View android:id="@+id/status_bar_placeholder" android:layout_width="match_parent" android:layout_height="0dp" android:background="@android:color/white" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHeight_percent="0.07" /> <!-- 顶部导航栏 --> <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@android:color/white" android:elevation="4dp" app:layout_constraintTop_toBottomOf="@id/status_bar_placeholder" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical"> <!-- 返回按钮 --> <ImageButton android:id="@+id/back_button" android:layout_width="48dp" android:layout_height="match_parent" android:background="@null" android:src="@drawable/ic_chevron_right" android:rotation="180" android:tint="@color/text_primary" android:contentDescription="返回" /> <!-- 标题 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="服务" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" /> </RelativeLayout> </androidx.appcompat.widget.Toolbar> <!-- 主要内容区域 --> <androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintTop_toBottomOf="@id/toolbar" app:layout_constraintBottom_toBottomOf="parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 顶部搜索栏和门店选择 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <!-- 搜索框 --> <LinearLayout android:id="@+id/search_container" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="1" android:background="@drawable/search_background" android:gravity="center_vertical" android:paddingHorizontal="12dp" android:orientation="horizontal"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_search" android:tint="@color/text_secondary" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="8dp" android:text="搜索服务项目..." android:textSize="14sp" android:textColor="@color/text_secondary" /> </LinearLayout> <!-- 选择门店按钮 --> <LinearLayout android:id="@+id/store_select_btn" android:layout_width="wrap_content" android:layout_height="40dp" android:background="@drawable/search_background" android:gravity="center_vertical" android:paddingHorizontal="12dp" android:orientation="horizontal" android:layout_marginLeft="8dp"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_map_marker" android:tint="@color/primary" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:text="选择门店" android:textSize="14sp" android:textColor="@color/text_primary" /> </LinearLayout> </LinearLayout> <!-- 服务分类区域 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="vertical"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="4dp" app:cardBackgroundColor="@android:color/white"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="24dp" android:orientation="vertical"> <!-- 标题 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="服务分类" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" android:layout_marginBottom="16dp" /> <!-- 分类网格 --> <GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="2" android:rowCount="2" <!-- 洗护服务 --> <LinearLayout android:id="@+id/category_grooming" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/service_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_paw" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="洗护服务" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="专业清洁护理" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> <!-- 美容造型 --> <LinearLayout android:id="@+id/category_beauty" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/shop_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_cut" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="美容造型" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="时尚造型设计" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> <!-- 寄养服务 --> <LinearLayout android:id="@+id/category_boarding" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/pets_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_home" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="寄养服务" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="温馨托管照顾" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> <!-- 乐园活动 --> <LinearLayout android:id="@+id/category_playground" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/stores_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_order" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="乐园活动" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="互动娱乐体验" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView> <!-- 精选服务推荐 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingHorizontal="16dp" android:paddingBottom="16dp" android:orientation="vertical" tools:ignore="MissingConstraints"> <!-- 标题和查看更多 --> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingVertical="8dp"> <TextView android:id="@+id/featured_services_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="精选服务" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" /> <TextView android:id="@+id/more_featured_services" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="查看更多" android:textSize="14sp" android:textColor="@color/primary" android:fontFamily="sans-serif-medium" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground" /> </RelativeLayout> <!-- 精选服务列表 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 精选服务1 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_1" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="专业洗护服务" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="深层清洁,让爱宠焕然一新" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宠爱宠物医院" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 精选服务2 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_2" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="美容造型" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="专业造型师,打造时尚爱宠" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="萌宠造型屋" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 精选服务3 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_3" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="豪华寄养" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="24小时看护,如家般温暖" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="温馨宠物之家" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 精选服务4 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_4" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="乐园互动" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="社交游戏,快乐成长时光" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宠物乐园" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> </LinearLayout> </LinearLayout> <!-- 热门门店推荐 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="vertical" tools:ignore="MissingConstraints"> <!-- 标题和查看更多 --> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingVertical="8dp"> <TextView android:id="@+id/popular_stores_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="热门门店" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" /> <TextView android:id="@+id/more_popular_stores" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="查看更多" android:textSize="14sp" android:textColor="@color/primary" android:fontFamily="sans-serif-medium" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground" /> </RelativeLayout> <!-- 热门门店列表 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 热门门店1 --> <androidx.cardview.widget.CardView android:id="@+id/popular_store_1" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/store_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宠爱宠物医院" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingVertical="4dp"> <!-- 评分 --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:text="4.9分 · 1.2km" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </RelativeLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="洗护 · 美容 · 医疗 · 寄养" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/store_status_background" android:paddingHorizontal="8dp" android:paddingVertical="4dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="营业中" android:textSize="10sp" android:textColor="@color/primary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 热门门店2 --> <androidx.cardview.widget.CardView android:id="@+id/popular_store_2" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/store_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="萌宠造型屋" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingVertical="4dp"> <!-- 评分 --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star_outline" android:tint="@color/yellow_400" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:text="4.7分 · 800m" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </RelativeLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="美容 · 造型 · 洗护" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/store_status_background" android:paddingHorizontal="8dp" android:paddingVertical="4dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="营业中" android:textSize="10sp" android:textColor="@color/primary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> </LinearLayout> </LinearLayout> <!-- 底部间距 --> <View android:layout_width="match_parent" android:layout_height="40dp" tools:ignore="MissingConstraints" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.core.widget.NestedScrollView> </androidx.constraintlayout.widget.ConstraintLayout>优化一下
最新发布
12-17
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff2f2f2" tools:context="com.hik.netsdk.SimpleDemo.View.MainActivity"> <RelativeLayout android:id="@+id/ra_title" android:layout_width="match_parent" android:layout_height="44dp" android:background="@mipmap/title_bg"> <TextView android:id="@+id/titlename" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_gravity="center" android:text="易丰视频监控" android:textColor="@android:color/white" android:textSize="18sp" /> <ImageButton android:id="@+id/back" android:layout_width="40dp" android:layout_height="match_parent" android:background="@null" android:contentDescription="@null" android:paddingLeft="10dp" android:contentDescription="视频插件" android:src="@mipmap/img_back" /> <ImageButton android:id="@+id/ib_rotate" android:layout_width="50dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:contentDescription="@null" android:onClick="changeScreen" android:layout_marginRight="6dp" android:scaleType="centerInside" android:background="@drawable/gps_select" android:contentDescription="视频插件" android:src="@mipmap/ic_size_sel" /> </RelativeLayout> <RelativeLayout android:id="@+id/rl_control" android:layout_width="match_parent" android:layout_height="266dp" android:layout_alignParentBottom="true" > <LinearLayout android:id="@+id/ll_center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerInParent="true" android:background="@mipmap/ycjk_yp" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb1" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb2" /> <ImageButton android:visibility="gone" android:id="@+id/left_up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@null" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb3" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb4" /> </LinearLayout> <ImageButton android:id="@+id/ptz_top_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/nnew_video_up" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb1" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb3" /> <ImageButton android:visibility="gone" android:id="@+id/right_up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb2" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb4" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" > <ImageButton android:id="@+id/ptz_left_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/nnew_video_left" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_zj" /> <ImageButton android:id="@+id/ptz_right_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/nnew_video_right" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb4" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb2" /> <ImageButton android:visibility="gone" android:id="@+id/left_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb3" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb1" /> </LinearLayout> <ImageButton android:id="@+id/ptz_bottom_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/nnew_video_down" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb4" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb3" /> <ImageButton android:visibility="gone" android:id="@+id/right_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@null" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb2" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/ycjk_kb1" /> </LinearLayout> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toLeftOf="@id/ll_center" android:gravity="center" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageButton android:id="@+id/focus_add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:textSize="16dp" android:text="焦距 +" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical" > <ImageButton android:id="@+id/guangquan_add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more3" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:text="光圈 +" android:contentDescription="视频插件" android:textSize="16dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical" > <ImageButton android:id="@+id/zoom_add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more5" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:text="变倍 +" android:textSize="16dp" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toRightOf="@id/ll_center" android:gravity="center" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical" > <ImageButton android:id="@+id/foucus_reduce" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more2" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:text="焦距 -" android:textSize="16dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical" > <ImageButton android:id="@+id/guangquan_reduce" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more4" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:text="光圈 -" android:contentDescription="视频插件" android:textSize="16dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical" > <ImageButton android:id="@+id/zoom_reduce" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more6" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:text="变倍 -" android:textSize="16dp" /> </LinearLayout> </LinearLayout> </RelativeLayout> <RelativeLayout android:layout_above="@id/rl_control" android:layout_below="@id/ra_title" android:layout_width="match_parent" android:layout_height="match_parent" > <SurfaceView android:id="@+id/realplay_sv" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent" /> <ImageButton android:id="@+id/ib_rotate2" android:layout_width="40dp" android:layout_height="40dp" android:layout_alignParentLeft="true" android:layout_marginLeft="3dp" android:background="@color/green" android:contentDescription="@null" android:onClick="changeScreen" android:contentDescription="视频插件" android:src="@mipmap/img_systems_close" /> <ProgressBar android:id="@+id/liveProgressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /> <LinearLayout android:id="@+id/ll_hc" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" > <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" > <ImageButton android:id="@+id/ptz_top_btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/h_up" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" > <ImageButton android:id="@+id/ptz_bottom_btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/h_down" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" > <ImageButton android:id="@+id/ptz_left_btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/h_left" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" > <ImageButton android:id="@+id/ptz_right_btn2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@mipmap/h_right" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" > <ImageButton android:id="@+id/focus_add2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more1" /> </LinearLayout> <LinearLayout android:gravity="center" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > <ImageButton android:id="@+id/foucus_reduce2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more2" /> </LinearLayout> <LinearLayout android:gravity="center" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > <ImageButton android:id="@+id/zoom_add2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more5" /> </LinearLayout> <LinearLayout android:gravity="center" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > <ImageButton android:id="@+id/zoom_reduce2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:background="@drawable/video_more6" /> </LinearLayout> </LinearLayout> </RelativeLayout> </RelativeLayout> 依据上述代码解决报错:ptz_right_btn <ImageButton>: Touch target size too small <ImageButton>: Touch target size too small ptz_bottom_btn <ImageButton>: Touch target size too small
06-24
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值