在android中如何实现图中的布局,我仅知道需要使用RelativeLayout,对于用户名后面那个编辑文本,怎么去掉EditText控件中的边框呢?希望有人能够给出样例代码参考

解决方案 »

  1.   

    看不到图去边框  android:background="@null" 
      

  2.   

    EditText的background属性设置为@null就可以了:android:background="@null"
      

  3.   

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
        <CheckBox android:layout_alignParentBottom="true" 
         android:layout_centerHorizontal="true"
         android:layout_marginBottom="10dp"
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="自动登录" 
         android:id="@+id/checkBox1"/>
        <Button android:layout_above="@+id/checkBox1" 
         android:layout_margin="10dp"
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/button1" 
         android:text="注册"/>
         <Button android:layout_above="@+id/button1" 
         android:layout_margin="10dp"
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/button2" 
         android:text="登录"/>
        <RelativeLayout android:layout_above="@+id/button2" 
         android:layout_margin="10dp"
         android:layout_centerHorizontal="true"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:background="#ffffff">
         <TextView android:layout_alignParentLeft="true" 
         android:layout_margin="5dp"
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content" 
         android:text="用户名:"
         android:id="@+id/textView1"/>
            <EditText android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:background="@null"
         android:id="@+id/editText1" 
         android:layout_toRightOf="@+id/textView1"/> 
        <TextView android:layout_alignParentLeft="true" 
         android:layout_margin="5dp"
         android:layout_width="wrap_content"  
         android:layout_height="wrap_content" 
         android:text="密码:"
         android:id="@+id/textView2"
         android:layout_below="@+id/textView1"/>
            <EditText android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:background="@null"
         android:id="@+id/editText2" 
         android:layout_toRightOf="@+id/textView2"
         android:layout_below="@+id/editText1"/>
        </RelativeLayout>
    </RelativeLayout>