2013-05-01 100 views
0

我無法在登錄文本的頂部添加圖像。如何將我的徽標圖像添加到登錄文本區域。也可以有人請幫我添加一個免費的textafter後3個按鈕。 enter image description here在登錄屏幕上添加圖像

這裏是我的這個

<?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="wrap_content" 
    android:orientation="vertical" 
    > 

    <RelativeLayout 
     android:id="@+id/register" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:background="@drawable/jklogin4" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="20dp" 
      android:text="Login" 
      android:textAppearance="?android:attr/textAppearanceMedium" /> 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_below="@+id/textView1" 
      android:layout_marginLeft="18dp" 
      android:layout_marginTop="15dp" 
      android:text="Username" /> 

     <EditText 
      android:id="@+id/editText1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/textView2" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="5dp" 
      android:ems="10" /> 

     <EditText 
      android:id="@+id/editText2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/editText1" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="20dp" 
      android:ems="10" /> 

     <Button 
      android:id="@+id/close" 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBaseline="@+id/button2" 
      android:layout_alignBottom="@+id/button2" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="38dp" 
      android:background="@drawable/button_custom" 
      android:text="Cancel" /> 

     <Button 
      android:id="@+id/button1" 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignLeft="@+id/textView3" 
      android:layout_below="@+id/editText2" 
      android:layout_marginTop="16dp" 
      android:background="@drawable/button_custom" 
      android:text=" Enter " /> 

     <TextView 
      android:id="@+id/textView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignLeft="@+id/textView2" 
      android:layout_below="@+id/editText1" 
      android:text="Password" /> 

     <Button 
      android:id="@+id/button2" 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBaseline="@+id/button1" 
      android:layout_alignBottom="@+id/button1" 
      android:layout_alignRight="@+id/textView1" 
      android:background="@drawable/button_custom" 
      android:text="Signup" /> 

    </RelativeLayout> 

</RelativeLayout> 

感謝

代碼
+0

'請幫我添加免費textafter你想要的文字添加以下三個按鈕或之後3個按鈕的3個buttons'做什麼? – GrIsHu 2013-05-01 04:31:47

+0

@Grishu在三個按鈕之後。與三個長線一樣的自由文本 – Yogus 2013-05-01 04:39:55

+0

您可以添加'TextView'並提供可以在您的'String.xml'文件中定義的文本,其中包含3個按鈕。 – GrIsHu 2013-05-01 04:45:28

回答

0

試用中,我添加了圖像上的TextView的頂部,還增加了TextView低於3 Buttons,你需要它我下面的佈局代碼。

<?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="wrap_content" 
     android:orientation="vertical" 

<RelativeLayout 
    android:id="@+id/register" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:background="@drawable/jklogin4" > 
    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="20dp" 
     android:text="Login" 
     android:drawableTop="@drawable/ic_launcher" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 
    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/textView1" 
     android:layout_marginLeft="18dp" 
     android:layout_marginTop="15dp" 
     android:text="Username" /> 
    <EditText 
     android:id="@+id/editText1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView2" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="5dp" 
     android:ems="10" /> 
    <EditText 
     android:id="@+id/editText2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/editText1" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="20dp" 
     android:ems="10" /> 
    <Button 
     android:id="@+id/close" 
     style="?android:attr/buttonStyleSmall" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/button2" 
     android:layout_alignBottom="@+id/button2" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="38dp" 
     android:background="@drawable/button_custom" 
     android:text="Cancel" /> 
    <Button 
     android:id="@+id/button1" 
     style="?android:attr/buttonStyleSmall" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/textView3" 
     android:layout_below="@+id/editText2" 
     android:layout_marginTop="16dp" 
     android:background="@drawable/button_custom" 
     android:text=" Enter " /> 
    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/textView2" 
     android:layout_below="@+id/editText1" 
     android:text="Password" /> 
    <Button 
     android:id="@+id/button2" 
     style="?android:attr/buttonStyleSmall" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/button1" 
     android:layout_alignBottom="@+id/button1" 
     android:layout_alignRight="@+id/textView1" 
     android:background="@drawable/button_custom" 
     android:text="Signup" /> 
</RelativeLayout> 
    <TextView 
     android:id="@+id/text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="18dp" 
     android:layout_marginRight="18dp" 
     android:layout_marginTop="15dp" 
     android:layout_below="@+id/register" 
     android:text="ajsfoiahoihaoihaoifhasf hsohaoishdiuasgdouhasofhsaodfhosahoaisdfoashdfohsdfoih" /> 
    </RelativeLayout> 
1

添加drawable top屬性爲您登錄的TextView

即該屬性

android:drawableTop="@drawable/ic_launcher" <-- Your drawable name 

添加到該

<TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="20dp" 
      android:text="Login" 
      android:textAppearance="?android:attr/textAppearanceMedium" />