android:layout_alignParentRight

本文深入探讨Android布局中关键属性的使用,包括对齐、填充、边距等概念,并提供实例演示如何灵活运用这些属性实现高效布局设计。
android:layout_alignParentRight="true" 
使当前控件的右端和父控件的右端对齐。这里属性值只能为true或false,默认false。 
android:layout_marginLeft="10dip" 
使当前控件左边空出相应的空间。 
android:layout_toLeftOf="@id/ok" 
使当前控件置于id为ok的控件的左边。 
android:layout_alignTop="@id/ok" 
使当前控件与id控件的上端对齐。 


padding表示填充,margin表示边距 
可通过android:padding属性进行设置,4个方向的边距属性为android:paddingLeft, android:paddingRight, android:paddingTop, and android:paddingBottom. 


结论: 
*android:layout_marginBottom 
*android:layout_marginLeft 
*android:layout_marginRight 
*android:layout_marginTop 
上面几个属性的值是根据下面的相对位置的对象的值来做计算的,如果没有相对的对象就以总体布局来计算 
*android:layout_below 
*android:layout_above 
*android:layout_toLeftOf 
*android:layout_toRightOf 
*android:layout_alignTop 


*android:layout_centerHrizontal //是否支持横屏或竖屏 
*android:layout_centerVertical //这个根据单词的意思:中心垂直 
*android:layout_centerInparent // 
android:layout_centerInParent="true"//居中在父对象 
android:layout_centerInParent="false" ... 浏览器不支持多窗口显示,意思就是说所有页面在单一窗口打开,这样避免了页面布局控制显示问题 
下面的相对于父的相对位置 
*android:layout_alignParentBottom 
*android:layout_alignParentLeft 
*android:layout_alignParentRight 
*android:layout_alignParentTop 
*android:layout_alignWithParentIfMissing 
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <LinearLayout android:id="@+id/MainPage" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <RelativeLayout android:id="@+id/SerialContent" android:layout_width="match_parent" android:layout_height="60dp"> <TextView android:id="@+id/Serial" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="串口号" /> <Spinner android:id="@+id/SerialName" android:layout_width="100dp" android:layout_height="80dp" android:gravity="center" android:spinnerMode="dropdown" android:layout_toRightOf="@+id/Serial"/> <Spinner android:id="@+id/BaudRate" android:layout_width="140dp" android:layout_height="80dp" android:layout_toRightOf="@id/SerialName" android:gravity="center" android:spinnerMode="dropdown" /> <Button android:id="@+id/OpenSerial" android:layout_width="120dp" android:layout_height="match_parent" android:layout_toRightOf="@id/BaudRate" android:text="打开串口" /> <Button android:id="@+id/QuitSoftware" android:layout_width="140dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:text="退出软件" /> </RelativeLayout> <FrameLayout android:id="@+id/previewContent" android:layout_width="604.7dp" android:layout_height="430dp" 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="430dp" android:visibility="visible"> <TextView android:id="@+id/handle" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" 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="60dp" android:layout_toRightOf="@+id/handle"> <Button android:id="@+id/ChangeDial" android:layout_width="140dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:text="带拨号盘版" /> </RelativeLayout> <LinearLayout android:id="@+id/DialContent" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <EditText android:id="@+id/receivedDataView" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@android:drawable/editbox_background" android:focusable="false" android:focusableInTouchMode="false" android:cursorVisible="false" android:gravity="top|left" android:inputType="textMultiLine" android:padding="8dp" android:scrollbars="vertical" android:hint="等待数据..." android:textSize="14sp" /> <LinearLayout android:id="@+id/mianBoard" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical"> <LinearLayout android:id="@+id/control" android:layout_width="match_parent" android:layout_height="74dp" android:orientation="horizontal" android:visibility="visible"> <EditText android:id="@+id/commandInput" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:hint="输入指令" android:paddingLeft="10dp" android:inputType="text" android:maxLines="1" /> <Button android:id="@+id/sendButton" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="发送" /> <Button android:id="@+id/clearDataView" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="清空" /> </LinearLayout> <GridLayout android:id="@+id/keyBoard" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="4" android:columnCount="3" android:rowCount="4" android:visibility="visible"> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="1" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="2" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="3" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="4" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="5" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="6" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="7" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="8" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="9" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="*" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="0" /> <Button android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="#" /> </GridLayout> <GridLayout android:id="@+id/NoKeyBoard" android:layout_width="match_parent" android:layout_height="0dp" android:columnCount="6" android:rowCount="4" android:layout_weight="5" android:visibility="gone"> <TextView android:id="@+id/keyA" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEYA" android:gravity="center"/> <Button android:id="@+id/keyAStart" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1.2" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/keyAClose" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1.2" android:layout_rowWeight="1" android:text="关灯" /> <TextView android:id="@+id/keyB" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEYB" android:gravity="center"/> <Button android:id="@+id/keyBStart" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1.2" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/keyBClose" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1.2" android:layout_rowWeight="1" android:text="关灯" /> <TextView android:id="@+id/key1" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEY1" android:gravity="center"/> <Button android:id="@+id/key1Start" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/key1Close" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="关灯" /> <TextView android:id="@+id/key2" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEY2" android:gravity="center"/> <Button android:id="@+id/key2Start" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/key2Close" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="关灯" /> <TextView android:id="@+id/key3" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEY3" android:gravity="center"/> <Button android:id="@+id/key3Start" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/key3Close" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="关灯" /> <TextView android:id="@+id/key4" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEY4" android:gravity="center"/> <Button android:id="@+id/key4Start" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/key4Close" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="关灯" /> <TextView android:id="@+id/key5" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="KEY5" android:gravity="center"/> <Button android:id="@+id/key5Start" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="开灯" /> <Button android:id="@+id/key5Close" android:layout_width="0dp" android:layout_height="0dp" android:layout_columnWeight="1" android:layout_rowWeight="1" android:text="关灯" /> </GridLayout> </LinearLayout> </LinearLayout> </LinearLayout> </RelativeLayout> <RelativeLayout android:id="@+id/VoiceContent" android:layout_width="match_parent" android:layout_height="80dp"> <TextView android:id="@+id/voice" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="录音" /> <Button android:id="@+id/RecordingVoice" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@+id/voice" android:text="开始录音" /> <TextView android:id="@+id/ShowVoiceData" android:layout_width="150dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/RecordingVoice" android:background="@drawable/solid_shape" android:gravity="center" android:ellipsize="end" android:singleLine="false" android:maxLines="3"/> <Button android:id="@+id/PlayVoice" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@id/ShowVoiceData" android:text="播放语音" /> <Button android:id="@+id/DeleteAudioAndView" android:layout_width="150dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_margin="2dp" android:text="删除" /> </RelativeLayout> <RelativeLayout android:id="@+id/CameraContent" android:layout_width="match_parent" android:layout_height="80dp"> <TextView android:id="@+id/camera" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="摄像头" /> <Button android:id="@+id/OpenAndCloseCamera" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@+id/camera" android:text="打开摄像头" /> <Button android:id="@+id/photograph" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@id/OpenAndCloseCamera" android:text="拍照" /> <TextView android:id="@+id/PhotographData" android:layout_width="150dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/photograph" android:background="@drawable/solid_shape" android:gravity="center" android:ellipsize="end" android:singleLine="false" android:maxLines="3"/> <Button android:id="@+id/RecordingView" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_toRightOf="@+id/PhotographData" android:text="录制视频" /> <TextView android:id="@+id/RecordingViewData" android:layout_width="150dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/RecordingView" android:background="@drawable/solid_shape" android:gravity="center" android:ellipsize="end" android:singleLine="false" android:maxLines="3"/> <Button android:id="@+id/DeleteView" android:layout_width="150dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_margin="2dp" android:text="删除" /> </RelativeLayout> <LinearLayout android:id="@+id/ScreenTestContent" android:layout_width="match_parent" android:layout_height="80dp"> <TextView android:id="@+id/ScreenTest" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="屏幕测试" /> <Button android:id="@+id/ScreenCheck" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="屏幕检测" /> <TextView android:id="@+id/TouchScreenCheck" android:layout_width="150dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="触摸屏检测" /> <Button android:id="@+id/ScribingTest" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="划线测试" /> <Button android:id="@+id/SinglePointTest" android:layout_width="150dp" 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="80dp"> <TextView android:id="@+id/NetPort" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="网口" /> <TextView android:id="@+id/NetPortData" android:layout_width="150dp" android:layout_height="match_parent" android:ellipsize="end" android:layout_margin="2dp" android:gravity="center" android:background="@drawable/solid_shape"/> <TextView android:id="@+id/ping" android:layout_width="150dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="ping" /> <EditText android:id="@+id/pingInput" android:layout_width="150dp" android:layout_height="match_parent" android:hint="请输入" android:paddingLeft="10dp" android:text="192.168.1.1" android:layout_margin="2dp" android:inputType="text" android:maxLines="1"/> <Button android:id="@+id/pingSend" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="发送ping"/> <ScrollView android:id="@+id/scrollView" android:layout_width="200dp" android:layout_height="match_parent" android:fillViewport="true"> <TextView android:id="@+id/pingData" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/solid_shape" android:textSize="14sp" android:singleLine="false" android:maxLines="100" android:scrollbars="vertical" android:layout_margin="2dp"/> </ScrollView> <Button android:id="@+id/pingStop" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="停止"/> </LinearLayout> <RelativeLayout android:id="@+id/USBContent" android:layout_width="match_parent" android:layout_height="80dp"> <TextView android:id="@+id/USB" android:layout_width="160dp" android:layout_height="match_parent" android:background="@drawable/form_shape" android:gravity="center" android:text="USB接口" /> <TextView android:id="@+id/USBPath" android:layout_width="150dp" android:layout_height="match_parent" android:hint="未连接" android:ellipsize="end" android:layout_margin="2dp" android:gravity="center" android:background="@drawable/solid_shape" android:layout_toRightOf="@+id/USB"/> <Button android:id="@+id/getUSBPath" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="获取USB路径" android:layout_toRightOf="@+id/USBPath"/> <EditText android:id="@+id/WriteTextData" android:layout_width="150dp" android:layout_height="match_parent" android:inputType="text" android:paddingLeft="10dp" android:layout_toRightOf="@+id/getUSBPath"/> <Button android:id="@+id/WriteText" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="写入文本" android:layout_toRightOf="@+id/WriteTextData"/> <ScrollView android:id="@+id/scrollViewOpenTextData" android:layout_width="200dp" android:layout_height="match_parent" android:fillViewport="true" android:layout_toRightOf="@+id/WriteText"> <TextView android:id="@+id/OpenTextData" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/solid_shape" android:textSize="14sp" android:singleLine="false" android:maxLines="100" android:scrollbars="vertical" android:layout_margin="2dp" android:gravity="center"/> </ScrollView> <Button android:id="@+id/OpenText" android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="2dp" android:text="打开文本" android:layout_toRightOf="@+id/scrollViewOpenTextData"/> <Button android:id="@+id/DeleteText" android:layout_width="150dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_margin="2dp" android:text="删除" /> </RelativeLayout> </LinearLayout> </ScrollView>使以上代码实现自适应屏幕大小,给出全部完整的代码
08-14
<?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: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" tools:context=".fragment.remind.AddEditReminderActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/img_inquire_bg" /> <ImageView android:id="@+id/iv_back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="18dp" android:layout_marginTop="43dp" android:src="@mipmap/img_back" /> <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/dp_10" android:layout_marginTop="@dimen/dp_40" android:layout_toRightOf="@id/iv_back" android:text="添加提醒" android:textColor="#022E6F" android:textSize="16sp" android:textStyle="bold" /> <androidx.core.widget.NestedScrollView android:id="@+id/nested" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="100dp" android:background="@drawable/bg_bottom_sheet" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="@dimen/base_dp_20" android:paddingTop="@dimen/base_dp_20" android:paddingRight="@dimen/base_dp_20"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="手机号" android:textSize="@dimen/sp_14" /> <EditText android:id="@+id/ed_phone" android:layout_width="match_parent" android:layout_height="50dp" android:layout_centerVertical="true" android:layout_marginTop="@dimen/dp_10" android:background="@drawable/outcome_bg" android:hint="请输入手机号" android:inputType="number" android:paddingLeft="@dimen/dp_10" android:textColor="@color/black" android:textSize="12sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_10" android:text="运营商" android:textSize="@dimen/sp_14" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="@dimen/dp_10" android:background="@drawable/outcome_bg"> <TextView android:id="@+id/sp_operator" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerVertical="true" android:gravity="center_vertical" android:hint="请选择运营商" android:paddingLeft="@dimen/dp_10" android:textColor="@color/black" android:textSize="12sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@mipmap/wode_youjiantou" /> </RelativeLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_10" android:text="缴费日期(月)" android:textSize="@dimen/sp_14" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="@dimen/dp_10" android:background="@drawable/outcome_bg"> <TextView android:id="@+id/sp_payment_day" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerVertical="true" android:gravity="center_vertical" android:hint="请选择缴费日期" android:paddingLeft="@dimen/dp_10" android:textColor="@color/black" android:textSize="12sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@mipmap/wode_youjiantou" /> </RelativeLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="3dp" android:layout_marginTop="@dimen/base_dp_20" android:background="@color/anythink_EFEFEF" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="@dimen/base_dp_20" android:paddingTop="@dimen/base_dp_20" android:paddingRight="@dimen/base_dp_20"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="提醒频次" android:textSize="@dimen/sp_14" /> <TextView android:id="@+id/sp_remind_frequency" android:layout_width="match_parent" android:layout_height="50dp" android:layout_centerVertical="true" android:layout_marginTop="@dimen/dp_10" android:background="@drawable/outcome_bg" android:gravity="center_vertical" android:hint="请选择频次" android:paddingLeft="@dimen/dp_10" android:textColor="@color/black" android:textSize="12sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_10" android:text="提醒日期" android:textSize="@dimen/sp_14" /> <RelativeLayout android:id="@+id/ll_remind_day" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="@dimen/dp_10" android:background="@drawable/outcome_bg"> <TextView android:id="@+id/tv_remind_day" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerVertical="true" android:gravity="center_vertical" android:hint="请选择提醒日期" android:paddingLeft="@dimen/dp_10" android:textColor="@color/black" android:textSize="12sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@mipmap/wode_youjiantou" /> </RelativeLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_10" android:text="提醒时间" android:textSize="@dimen/sp_14" /> <RelativeLayout android:id="@+id/ll_remind_time" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="@dimen/dp_10" android:background="@drawable/outcome_bg"> <TextView android:id="@+id/tv_remind_time" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerVertical="true" android:gravity="center_vertical" android:hint="请选择提醒时间" android:paddingLeft="@dimen/dp_10" android:textColor="@color/black" android:textSize="12sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@mipmap/wode_youjiantou" /> </RelativeLayout> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView> <TextView android:id="@+id/btn_save_reminder" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginBottom="50dp" android:background="@mipmap/img_but" android:gravity="center" android:text="保存提醒" android:textColor="@color/white" android:textSize="15sp" android:layout_below="@id/nested" /> </RelativeLayout> </RelativeLayout>这个 <TextView android:id="@+id/btn_save_reminder" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginBottom="50dp" android:background="@mipmap/img_but" android:gravity="center" android:text="保存提醒" android:textColor="@color/white" android:textSize="15sp" android:layout_below="@id/nested" />悬浮在NestedScrollView包裹的控件上
11-25
<?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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值