直播平台软件开发,Android studio设置分割线

发布时间 2023-08-22 14:13:03作者: 云豹科技-苏凌霄

直播平台软件开发,Android studio设置分割线

该方法在xml布局文件中添加ImageView控件

设置竖直分割线时,设置宽度为0.5dp,高度为match_parent(与父控件等高),颜色设置为black(黑色),此处数值可根据需求自行更改

 


        <ImageView
            android:layout_width="0.5dp"
            android:layout_height="match_parent"
            android:background="@android:color/black"/>
 

设置水平分割线时,设置宽度为match_parent(与父控件等高),高度为0.5dp,颜色设置为black(黑色),此处数值可根据需求自行更改

 


    <ImageView
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:background="@android:color/black" />
 

 

设置为如图所示的界面,两个线性布局嵌套在一起,第一层中控件竖直放置,第二层中控件水平放置,代码如下

 


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="1">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <Button
            android:layout_width="47dp"
            android:layout_height="wrap_content"
            android:id="@+id/back_ccloth"
            android:text="⬅"
            android:background="#00000000"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:textSize="40dp"/>
        <ImageView
            android:layout_width="0.5dp"
            android:layout_height="match_parent"
            android:background="@android:color/black"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="110dp"
            android:text="标题"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:textSize="20dp"
            android:textColor="@android:color/black" />
    </LinearLayout>
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:background="@android:color/black" />
        </LinearLayout>

 

 以上就是直播平台软件开发,Android studio设置分割线, 更多内容欢迎关注之后的文章