【发布时间】:2018-07-30 10:14:18
【问题描述】:
我有一个编辑文本,我正在改变他的背景:
EditText textEmail;
textEmail.setBackgroundColor(Color.RED);
问题是edittext轮廓消失了,屏幕上有一个大红色的东西。 我该如何改变这一点,也许可以设置一个更大的轮廓......
这是我的 XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_white" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@null"
android:src="@drawable/bg_mdpi" />
<EditText
android:id="@+id/editText2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:hint="Password"
android:inputType="textPassword"
android:password="true"
android:maxWidth="220px"/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/editText2"
android:layout_marginTop="35dp"
android:minWidth="220px"
android:onClick="goLoging"
android:text="Login" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button1"
android:layout_alignBottom="@+id/button1"
android:layout_alignParentRight="true"
android:minWidth="220px"
android:text="Forgot Password" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="52dp"
android:visibility="gone" />
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView1"
android:layout_centerHorizontal="true"
android:hint="Email Adress"
android:inputType="textEmailAddress" />
</RelativeLayout>
【问题讨论】:
-
能否请您发布 XML 布局
-
谢谢 yakoub,这部分解决了我的问题。
标签: android android-view