文本视图超越了android的背景图片为什么?

时间:2016-10-29 13:10:39

标签: java android xml user-interface

这是我的问题:

enter image description here

正如您所看到的,消息背景对于文本来说太小了。如何将其更大化以封装textview? 我应该制作一个ImageView?或者我可以设置背景的宽度和高度? 这是消息内容:

<?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:id="@+id/content_message"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.example.rcrisan.bocterinomore.MessageActivity"
    tools:showIn="@layout/activity_message">


    <RelativeLayout
        android:id="@+id/messageContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="10dp">

        <TextView
            android:id="@+id/received"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:background="@drawable/receivedIcon"
            android:text="@string/messages"
            android:textSize="20sp"
            android:includeFontPadding="true"
            android:layout_below="@+id/sent" />

        <TextView
            android:id="@+id/sent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/sentIcon"
            android:textSize="20sp"
            android:layout_alignParentRight="true"
            android:text="@string/messages" />

    </RelativeLayout>
</RelativeLayout>

0 个答案:

没有答案