Android开发 02

今天开始进行记账本的XML布局的编写,首先进行activity_main.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="@color/grey_f3f3f3">

   <RelativeLayout
       android:id="@+id/main_top_layout"
       android:layout_width="match_parent"
       android:layout_height="50dp">
       <TextView
           android:text="@string/app_name"
           android:layout_width="wrap_content"
           android:layout_height="match_parent"
           android:gravity="center"
           android:padding="10dp"
           android:textStyle="bold"
           android:textSize="18dp"
           android:textColor="@color/black"/>
       <ImageView
           android:id="@+id/main_lv_search"
           android:layout_width="wrap_content"
           android:layout_height="match_parent"
           android:src="@mipmap/search"
           android:layout_alignParentRight="true"
           android:padding="10dp"/>
   </RelativeLayout>
    <ListView
        android:id="@+id/main_lv"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/main_top_layout"
        android:padding="10dp"
        android:divider="@null"
        android:dividerHeight="6dp"
        android:scrollbars="none"
        android:background="@color/grey_f3f3f3"/>
    <ImageButton
        android:id="@+id/main_btn_more"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@mipmap/more"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_margin="20dp"
        android:background="@drawable/main_morebtn_bg"/>
    <Button
        android:id="@+id/main_btn_edit"
        android:layout_width="100dp"
        android:layout_height="50dp"
        android:layout_alignBottom="@id/main_btn_more"
        android:background="@drawable/main_recordbtn_bg"
        android:layout_toLeftOf="@id/main_btn_more"
        android:text="@string/record"
        android:textStyle="bold"
        android:textColor="@color/white"
        android:drawableLeft="@mipmap/edit"
        android:gravity="center_vertical"/>
</RelativeLayout>

布局截图:

介于代码量,之后会很少贴代码,具体代码上传到我的GitHub上

GitHub:https://github.com/hutoob/AccountBook

 然后分享我学习的网址:

https://www.bilibili.com/video/BV1Ey4y1k73N

 

posted @ 2021-01-08 21:03  哦心有  阅读(59)  评论(0编辑  收藏  举报