RelativeLayout布局,以及部分常用属性介绍scaleType/gravity/layout_gravity [zt]

本文详细介绍了RelativeLayout在Android开发中的使用方法,包括水平居中、垂直居中等基本属性,以及与其它视图组件的位置关系设置,例如上下左右对齐等。此外还介绍了与布局相关的边距属性及ImageView的scaleType属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

From:http://blog.youkuaiyun.com/chenzheng_java/archive/2011/02/21/6198232.aspx

 

RelativeLayout用到的一些重要的属性: 

    第一类:属性值为true或false 
    android:layout_centerHorizontal  水平居中 
     android:layout_centerVertical   垂直居中 
    android:layout_centerInparent    相对于父元素完全居中 
    android:layout_alignParentBottom 贴紧父元素的下边缘 
    android:layout_alignParentLeft   贴紧父元素的左边缘 
    android:layout_alignParentRight  贴紧父元素的右边缘 
    android:layout_alignParentTop    贴紧父元素的上边缘 
    android:layout_alignWithParentIfMissing  如果对应的兄弟元素找不到的话就以父元素做参照物 

    第二类:属性值必须为id的引用名“@id/id-name” 
    android:layout_below      在某元素的下方 
    android:layout_above      在某元素的的上方 
    android:layout_toLeftOf   在某元素的左边 
    android:layout_toRightOf  在某元素的右边 

    android:layout_alignTop   本元素的上边缘和某元素的的上边缘对齐 
    android:layout_alignLeft  本元素的左边缘和某元素的的左边缘对齐 
    android:layout_alignBottom 本元素的下边缘和某元素的的下边缘对齐 
    android:layout_alignRight  本元素的右边缘和某元素的的右边缘对齐 

    第三类:属性值为具体的像素值,如30dip,40px 
    android:layout_marginBottom              离某元素底边缘的距离 
    android:layout_marginLeft                   离某元素左边缘的距离 
    android:layout_marginRight                 离某元素右边缘的距离 
    android:layout_marginTop                   离某元素上边缘的距离 


EditText的android:hint 

设置EditText为空时输入框内的提示信息。 

android:gravity  
android:gravity属性是对该view 内容的限定.比如一个button 上面的text.  你可以设置该text 在view的靠左,靠右等位置.以button为例,android:gravity="right"则button上面的文字靠右 

android:layout_gravity 
android:layout_gravity是用来设置该view相对与起父view 的位置.比如一个button 在linearlayout里,你想把该button放在靠左、靠右等位置就可以通过该属性设置.以button为例,android:layout_gravity="right"则button靠右 

android:layout_alignParentRight
 
使当前控件的右端和父控件的右端对齐。这里属性值只能为true或false,默认false。 

android:scaleType: 
android:scaleType是控制图片如何resized/moved来匹对ImageView的size。ImageView.ScaleType / android:scaleType值的意义区别: 

CENTER /center  按图片的原来size居中显示,当图片长/宽超过View的长/宽,则截取图片的居中部分显示 

CENTER_CROP / centerCrop  按比例扩大图片的size居中显示,使得图片长(宽)等于或大于View的长(宽) 

CENTER_INSIDE / centerInside  将图片的内容完整居中显示,通过按比例缩小或原来的size使得图片长/宽等于或小于View的长/宽 

FIT_CENTER / fitCenter  把图片按比例扩大/缩小到View的宽度,居中显示 

FIT_END / fitEnd   把图片按比例扩大/缩小到View的宽度,显示在View的下部分位置 

FIT_START / fitStart  把图片按比例扩大/缩小到View的宽度,显示在View的上部分位置 

FIT_XY / fitXY  把图片不按比例扩大/缩小到View的大小显示 

MATRIX / matrix 用矩阵来绘制,动态缩小放大图片来显示。 

** 要注意一点,Drawable文件夹里面的图片命名是不能大写的。

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/chat_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="#000000" android:keepScreenOn="true" android:layout_height="match_parent"> <LinearLayout android:id="@+id/rl_title" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content" android:background="@color/black_alpha_5"> <View android:id="@+id/statusBar" android:layout_width="match_parent" android:layout_height="0dp" android:background="#000000"/> <RelativeLayout android:layout_width="match_parent" android:layout_height="?actionBarSize"> <LinearLayout android:layout_alignParentLeft="true" android:id="@+id/exit" android:visibility="gone" android:layout_width="?actionBarSize" android:gravity="center" android:layout_height="?actionBarSize"> <TextView android:layout_width="wrap_content" android:text="退出" android:textColor="#FFFFFF" android:layout_height="wrap_content"/> </LinearLayout> <TextView android:id="@+id/memberName" android:layout_width="wrap_content" android:text="音频会议" android:textColor="#FFFFFF" android:layout_centerInParent="true" android:layout_height="wrap_content"/> <LinearLayout android:visibility="gone" android:id="@+id/switchCamera" android:layout_centerVertical="true" android:layout_toLeftOf="@id/memberMenu" android:layout_width="44dp" android:gravity="center" android:layout_height="44dp"> <ImageView android:layout_alignParentRight="true" android:layout_width="24dp" android:scaleType="fitXY" android:tint="#FFFFFF" android:src="@mipmap/rc_voip_switch_camera" android:layout_height="24dp"/> </LinearLayout> <LinearLayout android:id="@+id/memberMenu" android:layout_alignParentRight="true" android:layout_width="44dp" android:gravity="center" android:visibility="gone" android:layout_centerVertical="true" android:layout_height="44dp"> <ImageView android:layout_alignParentRight="true" android:layout_width="24dp" android:scaleType="fitXY" android:src="@mipmap/icon_menu_more_member" android:layout_height="24dp"/> </LinearLayout> </RelativeLayout> </LinearLayout> <FrameLayout android:layout_below="@id/rl_title" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="wrap_content" android:layout_gravity="right|bottom" android:visibility="gone" android:layout_marginBottom="150dp" android:layout_height="wrap_content" android:orientation="vertical"> <!--本地预览view--> <org.webrtc.mozi.video.view.RTCSurfaceView android:id="@+id/sf_local_view" android:layout_width="120dp" android:layout_height="150dp" android:layout_marginRight="16dp" android:layout_marginTop="4dp" android:layout_marginBottom="2dp"/> </LinearLayout> <!--会议View--> <FrameLayout android:visibility="gone" android:id="@+id/admin_surface_container" android:layout_width="match_parent" android:layout_height="match_parent" /> <RelativeLayout android:layout_width="match_parent" android:background="@color/dk_color_4c00C9F4" android:layout_height="match_parent"> <LinearLayout android:layout_below="@id/bottomLayout" android:layout_alignParentTop="true" android:layout_width="match_parent" android:orientation="vertical" android:layout_alignParentBottom="true" android:layout_above="@id/bottomLayout" android:layout_height="wrap_content"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <View android:id="@+id/otherView" android:background="#00000000" android:layout_width="match_parent" android:layout_height="match_parent"/> <androidx.recyclerview.widget.RecyclerView android:id="@+id/chat_content_user_list" android:layout_width="match_parent" android:layout_gravity="right" android:background="#50000000" android:layout_height="match_parent"/> </FrameLayout> </LinearLayout> <!--底部按钮--> <LinearLayout android:id="@+id/bottomLayout" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:orientation="vertical" android:layout_gravity="bottom|right" android:layout_height="wrap_content"> <TextView android:id="@+id/time2" android:layout_width="wrap_content" android:textColor="#FFFFFF" android:layout_gravity="center" android:layout_marginBottom="16dp" android:layout_height="wrap_content"/> <LinearLayout android:layout_width="match_parent" android:orientation="horizontal" android:gravity="center" android:layout_marginBottom="40dp" android:layout_height="wrap_content"> <ImageView android:id="@+id/mute" android:layout_width="wrap_content" android:src="@drawable/rc_voip_mute_selector" android:layout_height="wrap_content"/> <ImageView android:id="@+id/hangup" android:layout_marginLeft="44dp" android:layout_marginRight="44dp" android:layout_width="wrap_content" android:src="@mipmap/rc_voip_hang_up" android:background="@null" android:layout_height="wrap_content"/> <ImageView android:id="@+id/audio" android:layout_width="wrap_content" android:src="@drawable/rc_voip_speaker_selector" android:layout_height="wrap_content"/> </LinearLayout> </LinearLayout> </RelativeLayout> </FrameLayout> </RelativeLayout> 这是一个安卓页面的xml代码 我想在页面中间展示一个用户列表中的用户名 用户名均以相同大小的圆形展示 用户名过长时仅显示前两个字符 列表中的用户过多时 按照一定策略换行处理
05-29
<?xml version="1.0" encoding="utf-8"?> <layout xmlns:app="http://schemas.android.com/apk/res-auto"> <data> <variable name="viewModel" type="com.tplink.tpmifi.viewmodel.SmsBoxViewModel" /> </data> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:addStatesFromChildren="true" android:background="@drawable/toolbar_background" android:minHeight="@dimen/titlebar_height"> <LinearLayout android:id="@+id/title_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginStart="@dimen/titlebar_left_margin_start" android:background="@drawable/btn_bg" android:clickable="true" android:focusable="true" android:gravity="center" android:minWidth="@dimen/titlebar_height" android:minHeight="@dimen/titlebar_height" android:orientation="horizontal" android:visibility="visible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/title_left_icon" android:layout_width="@dimen/titlebar_action_image_size" android:layout_height="@dimen/titlebar_action_image_size" android:scaleType="centerInside" android:src="@drawable/arrow_back_white" android:visibility="visible" /> </LinearLayout> <com.tplink.design.text.TPTextView android:id="@+id/title_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginStart="@dimen/titlebar_title_name_margin_start" android:layout_toEndOf="@+id/title_left" android:layout_weight="1" android:fontFamily="sans-serif-medium" android:lines="1" android:textAlignment="gravity" android:textColor="@android:color/white" android:textSize="@dimen/tpds_all_text_size_18" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintHorizontal_bias="0" app:layout_constraintStart_toEndOf="@id/title_left" app:layout_constraintTop_toTopOf="parent" tools:text="Outbox" /> <com.tplink.design.text.TPTextView android:id="@+id/title_right_text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginEnd="20dp" android:layout_toStartOf="@+id/title_right_text2" android:background="@drawable/btn_bg" android:gravity="center" android:lines="1" android:padding="@dimen/tpds_all_dp_16" android:text="@{viewModel.isAllItemSelected ? @string/common_deselect_all :@string/common_select_all }" android:textAlignment="gravity" android:textColor="@color/white" android:textSize="@dimen/tpds_all_text_size_16" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/title_right_text2" app:layout_constraintHorizontal_bias="1" app:layout_constraintStart_toEndOf="@id/title_name" app:layout_constraintTop_toTopOf="parent" app:visibleOrGone="@{viewModel.editing}" tools:visibility="visible" /> <com.tplink.design.text.TPTextView android:id="@+id/title_right_text2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_marginEnd="16dp" android:background="@drawable/btn_bg" android:clickable="@{viewModel.totalMsgNum != 0 }" android:gravity="center" android:lines="1" android:padding="@dimen/tpds_all_dp_16" android:text="@{viewModel.editing ? @string/common_cancel : @string/common_edit }" android:textAlignment="gravity" android:textColor="@{viewModel.totalMsgNum != 0 ? @color/white : @color/title_bar_text_non_clickable }" android:textSize="@dimen/tpds_all_text_size_16" android:visibility="visible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="1" app:layout_constraintStart_toEndOf="@id/title_right_text1" app:layout_constraintTop_toTopOf="parent" tools:text="@string/common_edit" /> </androidx.constraintlayout.widget.ConstraintLayout> </layout>
最新发布
07-11
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/chat_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="#000000" android:keepScreenOn="true" android:layout_height="match_parent"> <LinearLayout android:id="@+id/rl_title" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content" android:background="@color/black_alpha_5"> <View android:id="@+id/statusBar" android:layout_width="match_parent" android:layout_height="0dp" android:background="#000000"/> <RelativeLayout android:layout_width="match_parent" android:layout_height="?actionBarSize"> <LinearLayout android:layout_alignParentLeft="true" android:id="@+id/exit" android:visibility="gone" android:layout_width="?actionBarSize" android:gravity="center" android:layout_height="?actionBarSize"> <TextView android:layout_width="wrap_content" android:text="退出" android:textColor="#FFFFFF" android:layout_height="wrap_content"/> </LinearLayout> <TextView android:id="@+id/memberName" android:layout_width="wrap_content" android:text="音频会议" android:textColor="#FFFFFF" android:layout_centerInParent="true" android:layout_height="wrap_content"/> <LinearLayout android:id="@+id/memberMenu" android:layout_alignParentRight="true" android:layout_width="44dp" android:gravity="center" android:visibility="gone" android:layout_centerVertical="true" android:layout_height="44dp"> <ImageView android:layout_alignParentRight="true" android:layout_width="24dp" android:scaleType="fitXY" android:src="@mipmap/icon_menu_more_member" android:layout_height="24dp"/> </LinearLayout> </RelativeLayout> </LinearLayout> <FrameLayout android:layout_below="@id/rl_title" android:layout_width="match_parent" android:layout_height="match_parent"> <!--会议View--> <FrameLayout android:visibility="gone" android:id="@+id/admin_surface_container" android:layout_width="match_parent" android:layout_height="match_parent" /> <RelativeLayout android:layout_width="match_parent" android:background="@color/dk_color_4c00C9F4" android:layout_height="match_parent"> <com.google.android.flexbox.FlexboxLayout xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/username_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="8dp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" app:flexWrap="wrap" app:flexDirection="row" app:alignItems="flex_start"> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bg_circle" android:gravity="center" android:textColor="@android:color/white" android:textSize="14sp" android:layout_marginStart="18dp" android:text="陈倩蓓" android:padding="4dp" /> </com.google.android.flexbox.FlexboxLayout> <!--底部按钮--> <LinearLayout android:id="@+id/bottomLayout" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:orientation="vertical" android:layout_gravity="bottom|right" android:layout_height="wrap_content"> <TextView android:id="@+id/time2" android:layout_width="wrap_content" android:textColor="#FFFFFF" android:layout_gravity="center" android:layout_marginBottom="16dp" android:layout_height="wrap_content"/> <LinearLayout android:layout_width="match_parent" android:orientation="horizontal" android:gravity="center" android:layout_marginBottom="40dp" android:layout_height="wrap_content"> <ImageView android:id="@+id/mute" android:layout_width="wrap_content" android:src="@drawable/rc_voip_mute_selector" android:layout_height="wrap_content"/> <ImageView android:id="@+id/hangup" android:layout_marginLeft="44dp" android:layout_marginRight="44dp" android:layout_width="wrap_content" android:src="@mipmap/rc_voip_hang_up" android:background="@null" android:layout_height="wrap_content"/> <ImageView android:id="@+id/audio" android:layout_width="wrap_content" android:src="@drawable/rc_voip_speaker_selector" android:layout_height="wrap_content"/> </LinearLayout> </LinearLayout> </RelativeLayout> </FrameLayout> </RelativeLayout> 如何让"陈倩蓓"所在的组件在父组件中水平居中
05-31
<?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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值