android美化短信聊天记录使得输入长短信不顶格

本文介绍了发送短信和接收短信的界面设计,包括布局、样式等详细信息。通过XML代码展示了短信发送及接收时的具体显示效果。

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

发送短信界面:

<?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="right"
    android:orientation="vertical" >
	<!-- 包含占位框和收到短信框 -->
    <LinearLayout
        android:id="@id/sms_detail_send_right_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right" >
	<!-- 占位框 -->
        <TextView
            android:id="@id/sms_detail_send_placeholder"
            android:layout_width="30dp"
            android:layout_height="wrap_content" />
<!-- 发出的短信 -->
        <TextView
            android:id="@id/sms_detail_send_right_message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:background="@drawable/sms_detail_content_right_bg"
            android:gravity="center_vertical"
            android:textColor="#000000" />
    </LinearLayout>

<!-- 显示日期 -->
    <TextView
        android:id="@id/sms_detail_send_right_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        />

</LinearLayout>



接收短信界面:

<?xml version="1.0" encoding="utf-8"?>
<!-- 收到的短信:左邊 -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="left"
    android:orientation="vertical" >

    <!-- 短信接收日期 -->

    <TextView
        android:id="@id/sms_detail_receive_left_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/sms_detail_receive_left_layout" />
    <!-- 占位框 -->

    <TextView
        android:id="@id/sms_detail_receive_placeholder"
        android:layout_width="30dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignRight="@id/sms_detail_receive_left_message" />
    <!-- 用LinearLayout包裹发出的短信框 -->

    <LinearLayout
        android:id="@id/sms_detail_receive_left_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/sms_detail_receive_placeholder" >

        <!-- 发出的短信 -->

        <TextView
            android:id="@id/sms_detail_receive_left_message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/sms_detail_content_left_bg"
            android:gravity="center_vertical"
            android:text="s"
            android:textColor="#000000" />
    </LinearLayout>

</RelativeLayout>

效果:

s wqnmbg弄了一个晚上就这一个破效果,搞死我了

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值