代码实现Layout android:layout_alignParentRight

本文介绍了如何使用Android的RelativeLayout实现视图元素右对齐,并通过具体代码示例展示了设置属性android:layout_alignParentRight为true的方法。

代码实现Layout android:layout_alignParentRight

例如:

     android:id="@+id/account_option" android:layout_width="20px"
     android:layout_height="20px" android:focusable="true"
     android:src="@drawable/accountoptionbutton"
     android:layout_alignParentRight="true" android:layout_marginRight="25px" />

----------------------------------------------------------------------------------

        RelativeLayout rl =    new RelativeLayout(this);     
        MarginLayoutParams mp = new MarginLayoutParams(20,20);  //item的宽高
        mp.setMargins(0, 0, 25, 0);//分别是margin_top那四个属性
        LayoutParams lp = new LayoutParams(mp);
        lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
       
        Button bt = new Button(this);
        bt.setLayoutParams(lp);
        rl.addView(bt);

转载于:https://www.cnblogs.com/dongweiq/p/4171919.html

<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/MainPage" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <RelativeLayout android:id="@+id/SerialContent" android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:id="@+id/Serial" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="串口号:" /> <TextView android:id="@+id/SerialName" android:layout_width="100dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/Serial" android:gravity="center" android:text="未连接" android:textColor="#888888" android:background="@drawable/solid_shape"/> <Button android:id="@+id/OpenSerial" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@id/SerialName" android:text="打开串口" /> <Button android:id="@+id/QuitSoftware" android:layout_width="140dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_margin="2dp" android:text="退出软件" /> </RelativeLayout> <FrameLayout android:id="@+id/previewContent" android:layout_width="569dp" android:layout_height="320dp" android:visibility="gone"> <androidx.camera.view.PreviewView android:id="@+id/preview" android:layout_width="match_parent" android:layout_height="match_parent" /> </FrameLayout> <RelativeLayout android:id="@+id/handleContent" android:layout_width="match_parent" android:layout_height="320dp" android:visibility="visible"> <TextView android:id="@+id/handle" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="手柄" /> <LinearLayout android:id="@+id/RightContent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toRightOf="@+id/handle" android:orientation="vertical"> <RelativeLayout android:id="@+id/content1" android:layout_width="match_parent" android:layout_height="40dp" android:layout_toRightOf="@+id/handle"> <TextView android:id="@+id/ForkSprings" android:layout_width="100dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="叉簧:" /> <TextView android:id="@+id/ForkSpringsStatus" android:layout_width="80dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/ForkSprings" android:gravity="center" android:text="未连接" android:textColor="#888888" android:background="@drawable/solid_shape"/> <Button android:id="@+id/ChangeDial" android:layout_width="140dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:text="带拨号盘版" /> </RelativeLayout> <RelativeLayout android:id="@+id/content2" android:layout_width="match_parent" android:layout_height="40dp"> <Button android:id="@+id/btnA" android:layout_width="100dp" android:layout_height="match_parent" android:text="按钮A" /> <TextView android:id="@+id/ShowBtnAStatus" android:layout_width="80dp" android:layout_height="match_parent" android:layout_toRightOf="@id/btnA" android:gravity="center" android:text="r140" /> <TextView android:id="@+id/AFlashing" android:layout_width="40dp" android:layout_height="match_parent" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowBtnAStatus" android:background="@drawable/lamp_shape" android:gravity="center" android:text="A" /> <Button android:id="@+id/AStart" android:layout_width="100dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/AFlashing" android:text="A开灯" /> <Button android:id="@+id/AClose" android:layout_width="100dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/AStart" android:text="A关灯" /> </RelativeLayout> <RelativeLayout android:id="@+id/content3" android:layout_width="match_parent" android:layout_height="40dp"> <Button android:id="@+id/btnB" android:layout_width="100dp" android:layout_height="match_parent" android:text="按钮B" /> <TextView android:id="@+id/ShowBtnBStatus" android:layout_width="80dp" android:layout_height="match_parent" android:layout_toRightOf="@id/btnB" android:gravity="center" android:text="r130" /> <TextView android:id="@+id/BFlashing" android:layout_width="40dp" android:layout_height="match_parent" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowBtnBStatus" android:background="@drawable/lamp_shape" android:gravity="center" android:text="B" /> <Button android:id="@+id/BStart" android:layout_width="100dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/BFlashing" android:text="B开灯" /> <Button android:id="@+id/BClose" android:layout_width="100dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/BStart" android:text="B关灯" /> </RelativeLayout> <LinearLayout android:id="@+id/DialContent" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:visibility="visible"> <TextView android:id="@+id/display" android:layout_width="match_parent" android:layout_height="40dp" android:background="#E8E8E8" android:gravity="center" android:hint="请输入" /> <GridLayout android:id="@+id/keyboard" android:layout_width="match_parent" android:layout_height="match_parent" android:columnCount="3" android:rowCount="4"> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="1" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="2" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="3" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="4" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="5" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="6" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="7" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="8" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="9" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="DEL" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="0" /> <Button android:layout_width="0dp" android:layout_height="40dp" android:layout_columnWeight="1" android:text="OK" /> </GridLayout> </LinearLayout> <RelativeLayout android:id="@+id/NoDialContent" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone"> <Button android:id="@+id/key1" android:layout_width="100dp" android:layout_height="40dp" android:text="KEY1" /> <TextView android:id="@+id/ShowKey1" android:layout_width="80dp" android:layout_height="40dp" android:layout_toRightOf="@+id/key1" android:gravity="center" android:text="r150" /> <TextView android:id="@+id/key1Flashing" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowKey1" android:background="@drawable/lamp_shape" android:gravity="center" android:text="key1" /> <Button android:id="@+id/key1Start" android:layout_width="100dp" android:layout_height="40dp" android:layout_toRightOf="@+id/key1Flashing" android:text="开灯" /> <Button android:id="@+id/key1Close" android:layout_width="100dp" android:layout_height="40dp" android:layout_toRightOf="@+id/key1Start" android:text="关灯" /> <Button android:id="@+id/key2" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key1" android:text="KEY2" /> <TextView android:id="@+id/ShowKey2" android:layout_width="80dp" android:layout_height="40dp" android:layout_below="@+id/ShowKey1" android:layout_toRightOf="@+id/key2" android:gravity="center" android:text="r160" /> <TextView android:id="@+id/key2Flashing" android:layout_width="40dp" android:layout_height="40dp" android:layout_below="@+id/key1Flashing" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowKey2" android:background="@drawable/lamp_shape" android:gravity="center" android:text="key2" /> <Button android:id="@+id/key2Start" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key1Start" android:layout_toRightOf="@+id/key2Flashing" android:text="开灯" /> <Button android:id="@+id/key2Close" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key1Close" android:layout_toRightOf="@+id/key2Start" android:text="关灯" /> <Button android:id="@+id/key3" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key2" android:text="KEY3" /> <TextView android:id="@+id/ShowKey3" android:layout_width="80dp" android:layout_height="40dp" android:layout_below="@+id/ShowKey2" android:layout_toRightOf="@+id/key3" android:gravity="center" android:text="r170" /> <TextView android:id="@+id/key3Flashing" android:layout_width="40dp" android:layout_height="40dp" android:layout_below="@+id/key2Flashing" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowKey3" android:background="@drawable/lamp_shape" android:gravity="center" android:text="key3" /> <Button android:id="@+id/key3Start" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key2Start" android:layout_toRightOf="@+id/key3Flashing" android:text="开灯" /> <Button android:id="@+id/key3Close" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key2Close" android:layout_toRightOf="@+id/key3Start" android:text="关灯" /> <Button android:id="@+id/key4" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key3" android:text="KEY4" /> <TextView android:id="@+id/ShowKey4" android:layout_width="80dp" android:layout_height="40dp" android:layout_below="@+id/ShowKey3" android:layout_toRightOf="@+id/key4" android:gravity="center" android:text="r180" /> <TextView android:id="@+id/key4Flashing" android:layout_width="40dp" android:layout_height="40dp" android:layout_below="@+id/key3Flashing" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowKey4" android:background="@drawable/lamp_shape" android:gravity="center" android:text="key4" /> <Button android:id="@+id/key4Start" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key3Start" android:layout_toRightOf="@+id/key4Flashing" android:text="开灯" /> <Button android:id="@+id/key4Close" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key3Close" android:layout_toRightOf="@+id/key4Start" android:text="关灯" /> <Button android:id="@+id/key5" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key4" android:text="KEY5" /> <TextView android:id="@+id/ShowKey5" android:layout_width="80dp" android:layout_height="40dp" android:layout_below="@+id/ShowKey4" android:layout_toRightOf="@+id/key5" android:gravity="center" android:text="r190" /> <TextView android:id="@+id/key5Flashing" android:layout_width="40dp" android:layout_height="40dp" android:layout_below="@+id/key4Flashing" android:layout_marginRight="10dp" android:layout_toRightOf="@id/ShowKey5" android:background="@drawable/lamp_shape" android:gravity="center" android:text="key5" /> <Button android:id="@+id/key5Start" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key4Start" android:layout_toRightOf="@+id/key5Flashing" android:text="开灯" /> <Button android:id="@+id/key5Close" android:layout_width="100dp" android:layout_height="40dp" android:layout_below="@+id/key4Close" android:layout_toRightOf="@+id/key5Start" android:text="关灯" /> </RelativeLayout> </LinearLayout> </RelativeLayout> <RelativeLayout android:id="@+id/VoiceContent" android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:id="@+id/voice" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="录音" /> <Button android:id="@+id/RecordingVoice" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@+id/voice" android:text="开始录音" /> <TextView android:id="@+id/ShowVoiceData" android:layout_width="100dp" android:layout_height="match_parent" android:textSize="10dp" android:gravity="center" android:layout_toRightOf="@+id/RecordingVoice" android:background="@drawable/solid_shape"/> <Button android:id="@+id/PlayVoice" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="播放语音" android:layout_toRightOf="@id/ShowVoiceData"/> <Button android:id="@+id/DeleteAudioAndView" android:layout_width="80dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="删除" android:layout_alignParentRight="true"/> </RelativeLayout> <RelativeLayout android:id="@+id/CameraContent" android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:id="@+id/camera" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="摄像头" /> <Button android:id="@+id/OpenAndCloseCamera" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@+id/camera" android:text="打开摄像头" /> <Button android:id="@+id/photograph" android:layout_width="100dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@id/OpenAndCloseCamera" android:text="拍照" /> <TextView android:id="@+id/PhotographData" android:layout_width="100dp" android:layout_height="match_parent" android:textSize="10dp" android:gravity="center" android:maxLines="3" android:ellipsize="end" android:layout_toRightOf="@+id/photograph" android:background="@drawable/solid_shape"/> <Button android:id="@+id/RecordingView" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@+id/PhotographData" android:text="录制视频" /> <TextView android:id="@+id/RecordingViewData" android:layout_width="100dp" android:layout_height="match_parent" android:textSize="10dp" android:gravity="center" android:maxLines="3" android:ellipsize="end" android:layout_toRightOf="@+id/RecordingView" android:background="@drawable/solid_shape"/> <Button android:id="@+id/DeleteView" android:layout_width="80dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_alignParentRight="true" android:text="删除" /> </RelativeLayout> <LinearLayout android:id="@+id/ScreenTestContent" android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:id="@+id/ScreenTest" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="屏幕测试" /> <Button android:id="@+id/ScreenCheck" android:layout_width="120dp" android:layout_height="match_parent" android:text="屏幕检测" android:layout_margin="2dp"/> <TextView android:id="@+id/TouchScreenCheck" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="触摸屏检测" /> <Button android:id="@+id/ScribingTest" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="划线测试" /> <Button android:id="@+id/SinglePointTest" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="单点测试" /> </LinearLayout> <LinearLayout android:id="@+id/NetPortContent" android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:id="@+id/NetPort" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="网口" /> <TextView android:id="@+id/NetPortData" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp"/> <TextView android:id="@+id/ping" android:layout_width="160dp" android:layout_height="match_parent" android:text="ping" android:gravity="center" android:background="#CECECE" /> <TextView android:id="@+id/pingData" android:layout_width="120dp" android:layout_height="match_parent"/> </LinearLayout> <LinearLayout android:id="@+id/USBContent" android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:id="@+id/USB" android:layout_width="160dp" android:layout_height="match_parent" android:background="#CECECE" android:gravity="center" android:text="USB接口" /> <TextView android:id="@+id/WriteTextData" android:layout_width="80dp" android:layout_height="match_parent" /> <Button android:id="@+id/WriteText" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="写入文本" /> <TextView android:id="@+id/OpenTextData" android:layout_width="80dp" android:layout_height="match_parent" /> <Button android:id="@+id/OpenText" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="打开文本" /> <Button android:id="@+id/DeleteText" android:layout_width="120dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="删除文本" /> </LinearLayout> </LinearLayout> 在以上布局文件中,让以下部分在里面居中 <androidx.camera.view.PreviewView android:id="@+id/preview" android:layout_width="match_parent" android:layout_height="match_parent" /> </FrameLayout>居中
最新发布
08-02
<?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: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: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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" android:background="@mipmap/ycjk_kb3" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" android:background="@mipmap/ycjk_kb2" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" android:background="@drawable/nnew_video_left" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" android:background="@mipmap/ycjk_zj" /> <ImageButton android:id="@+id/ptz_right_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" android:background="@mipmap/ycjk_kb3" /> </LinearLayout> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="视频插件" android:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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:minWidth="48dp" android:minHeight="48dp" android:padding="12dp" 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: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> 依据上述代码解决报错 <ImageButton>: Touch target size too small <ImageButton>: Touch target size too small <ImageButton>: Touch target size too small <ImageButton>: Touch target size too small <ImageButton>: Touch target size too small
06-24
<?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
根据上述功能,优化包含边框的悬浮窗布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clipChildren="true" android:clipToPadding="true" android:orientation="vertical"> <View android:id="@+id/drag_top" android:layout_width="wrap_content" android:layout_height="14dp" android:visibility="gone" android:layout_gravity="top" android:background="@color/milu_orange" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <View android:id="@+id/drag_left" android:layout_width="14dp" android:layout_height="match_parent" android:visibility="gone" android:background="@color/milu_orange" /> <LinearLayout android:id="@+id/content_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:paddingBottom="10dp"> <LinearLayout android:id="@+id/ll_draggable" android:layout_width="25dp" android:layout_height="25dp" android:layout_centerVertical="true" android:gravity="center"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ml_chat_draggable" /> </LinearLayout> <TextView android:layout_width="43dp" android:layout_height="3dp" android:layout_centerInParent="true" android:background="@drawable/botton_yuan_ef_5" /> <LinearLayout android:id="@+id/ll_close" android:layout_width="25dp" android:layout_height="25dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:gravity="center"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ml_bjlb_close" /> </LinearLayout> </RelativeLayout> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rlv_messagr" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="5" android:scrollbars="none" /> <TextView android:layout_width="wrap_content" android:layout_height="0dp" android:background="@drawable/bg_redius_transparent_75" android:paddingHorizontal="15dp" android:layout_weight="1" android:paddingVertical="5dp" android:text="说点什么吧" android:textColorHint="@color/milu_color_99" /> </LinearLayout> <View android:id="@+id/drag_right" android:layout_width="14dp" android:layout_height="match_parent" android:visibility="gone" android:background="@color/milu_orange" /> </LinearLayout> <LinearLayout android:id="@+id/ll_bottom" android:layout_width="match_parent" android:layout_height="14dp" android:visibility="gone" android:layout_gravity="left|bottom" android:orientation="horizontal"> <View android:id="@+id/drag_bottom_left" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/milu_orange" /> <View android:id="@+id/drag_bottom_right" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/milu_orange" /> </LinearLayout> </LinearLayout>
07-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值