Android学习第二天--ImageButton

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
<!-- 相对布局 -->
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/username" 
        android:id="@+id/textview1"/>
    
    <EditText 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/textview1"
        android:layout_marginLeft="50dp"
        android:layout_marginTop="30dp"
        android:id="@+id/edittext1"
        android:width="50dp"/>
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/userpasswd"
        android:layout_below="@id/edittext1"
        android:id="@+id/textview2" />
    
    <EditText 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/edittext1"
        android:layout_toRightOf="@id/textview2"
        android:id="@+id/edittext2"
        android:maxLength="10"
        android:maxLines="1"
        android:password="true"/>
    <ImageButton 
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@drawable/shanzi"
        android:layout_below="@id/edittext2"/>
</RelativeLayout>

 以上是第一个应用;

以下是第二个:

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/image" />
    
    <ImageView 
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@drawable/tree"
        android:id="@+id/imageview"/>

</LinearLayout>

 

posted @ 2013-03-09 16:32  小三小山  阅读(112)  评论(0编辑  收藏  举报