Andoird Studio写一个简单的生词本项目

此博客链接:

1.在activity_main.xml中复制下面代码。

<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"
    android:background="#CCCCCC"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
 
    <LinearLayout 
        android:layout_marginTop="50dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        
        <Button 
            style="?android:attr/buttonBarButtonStyle"
            android:id="@+id/insert"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:background="@drawable/shape" />
        <Button
            style="?android:attr/buttonBarButtonStyle"
            android:id="@+id/search"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:background="@drawable/shape" />
        <Button 
            style="?android:attr/buttonBarButtonStyle"
            android:id="@+id/delete"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:background="@drawable/shape" />
        
    </LinearLayout>
    
    <RelativeLayout 
        android:layout_marginTop="200dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        
        <EditText 
            android:id="@+id/word"
            android:background="@drawable/edittextshape"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:padding="3dp"
            android:inputType="textUri"
            android:hint="@string/word" />
 
        <ImageButton
            android:id="@+id/clear1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:contentDescription="@string/clear"
            android:src="@drawable/clear"
            android:visibility="visible" />
        
    </RelativeLayout>
    <RelativeLayout 
        android:layout_marginTop="300dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">        
        <EditText 
            android:inputType="text"
            android:id="@+id/detail"
            android:background="@drawable/edittextshape"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:padding="3dp"
            android:hint="@string/detail"
            android:textColorHint="#AAAAAA" />        
        <ImageButton
            android:id="@+id/clear2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:contentDescription="@string/clear"
            android:src="@drawable/clear"
            android:visibility="visible" />
        
    </RelativeLayout>
    <RelativeLayout 
        android:layout_marginTop="400dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">        
        <EditText 
            android:background="@drawable/edittextshape"
            android:inputType="textUri"
            android:id="@+id/search_edittext"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:padding="3dp"
            android:hint="@string/search" />
        
        <ImageButton
            android:id="@+id/clear3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:contentDescription="@string/clear"
            android:src="@drawable/clear"
            android:visibility="visible" />        
    </RelativeLayout>
</RelativeLayout>

 

 

posted @ 2020-06-11 20:20  萍2樱释  阅读(634)  评论(0编辑  收藏  举报