上下两排textView用RelativeLayout布局

有效的减少布局结构加快界面绘制速度

textview
<?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:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/tv_day"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_margin="15dp"
        android:text="TextView"
        android:textColor="#959595" />

    <TextView
        android:id="@+id/tv_kcal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/tv_day"
        android:layout_alignBottom="@+id/tv_day"
        android:layout_centerHorizontal="true"
        android:text="卡路里燃烧" />

    <TextView
        android:id="@+id/tv_step"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tv_day"
        android:layout_alignStart="@+id/tv_day"
        android:layout_below="@+id/tv_day"
        android:text="246步"
        android:textColor="#333333"
        android:textSize="14sp" />


    <TextView
        android:id="@+id/tv_calorie"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/tv_dw"
        android:layout_alignBottom="@+id/tv_dw"
        android:layout_alignLeft="@+id/tv_kcal"
        android:layout_alignStart="@+id/tv_kcal"
        android:text="20"
        android:textSize="14sp"
        tools:textColor="#333333" />

    <TextView
        android:id="@+id/tv_dw"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tv_day"
        android:layout_toEndOf="@+id/tv_calorie"
        android:layout_toRightOf="@+id/tv_calorie"
        android:text="千卡"
        android:textColor="#333333" />
</RelativeLayout>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容