Android EditText不显示其完整布局

Android EditText不显示其完整布局,android,android-edittext,Android,Android Edittext,我有以下文本 <EditText android:id="@+id/editText7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1"

我有以下文本

          <EditText
            android:id="@+id/editText7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10" />

对于这个编辑文本,我有如下布局

但我想得到如下编辑文本:


如何获得上述编辑文本?

您可以在编辑文本中设置填充

android:padding="10dp"

创建可绘制的background.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@android:color/very_light_grey"/>
    <stroke android:width="1dp" android:color="@color/grey"/>
</shape>

将编辑文本更改为

<EditText
  android:background="@drawable/background"
  android:layout_width="match_parent"
  android:paddingLeft="60dp"
  android:layout_height="wrap_content"/>


它基本上与安卓版本的设备配套。安卓早期版本的EditText与您想要的有点类似。但用最新的,你会得到线。我建议更改编辑文本主题或背景以满足您的需要。

使用

android:background="Your Color Code"

您可以使用XML创建。检查并查看我的编辑答案它解决了你的问题我检查了它……错误:未找到与给定名称匹配的资源(在“color”处,值为“@android:color/very_light_grey”)。将名为your_background_color的颜色添加到colors.xml文件中,并将其更改为@colors/your_background_color。