ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

安卓系统记账本app第二天

2021-12-31 21:03:55  阅读:157  来源: 互联网

标签:layout 安卓 item 10dp 记账 app 添加 id android


因为电脑坏了,所以中间隔了好几天。不多说开始今天的学习

今天写了两个新的layout

 

item_mainlv_top

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey_f3f3f3">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:padding="20dp">
        <TextView
            android:id="@+id/item_mainlv_top_tv1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/month_out"/>
        <TextView
            android:id="@+id/item_mainlv_top_tv_out"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="¥ 0"
            android:layout_below="@+id/item_mainlv_top_tv1"
            android:textSize="26dp"
            android:textStyle="bold"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:textColor="@color/black"/>
        <ImageView
            android:id="@+id/item_mainlv_top_iv_hide"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:src="@mipmap/ih_show"
            android:layout_alignTop="@id/item_mainlv_top_tv_out"/>
        <TextView
            android:id="@+id/item_mainlv_top_tv2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/month_in"
            android:layout_below="@+id/item_mainlv_top_tv_out"/>
        <TextView
            android:id="@+id/item_mainlv_top_tv_in"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/black"
            android:text="¥ 0 "
            android:layout_below="@+id/item_mainlv_top_tv_out"
            android:layout_toRightOf="@+id/item_mainlv_top_tv2"
            android:layout_marginLeft="5dp"/>
        <TextView
            android:id="@+id/item_mainlv_top_tv_budget"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="¥ 0 "
            android:textColor="@color/black"
            android:layout_alignParentRight="true"
            android:layout_alignBottom="@+id/item_mainlv_top_tv2"
            android:layout_marginLeft="5dp"/>
        <TextView
            android:id="@+id/item_mainlv_top_tv3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/budget"
            android:layout_toLeftOf="@+id/item_mainlv_top_tv_budget"
            android:layout_alignBottom="@id/item_mainlv_top_tv2"/>
        <TextView
            android:id="@+id/item_mainlv_top_tv4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableLeft="@mipmap/ih_biaoge"
            android:layout_below="@id/item_mainlv_top_tv2"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="20dp"
            android:text="@string/see_excel"
            android:textColor="@color/blue"
            android:drawablePadding="10dp"/>
    </RelativeLayout>
    <TextView
        android:id="@+id/item_mainlv_top_tv_day"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="今日支出¥ 0 收入 ¥ 0"
        android:textStyle="bold"

android:layout_marginTop="20dp" android:layout_marginBottom="10dp"/> </LinearLayout>

 

 

效果图

 

item_mainly

<?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:layout_margin="10dp"
    android:padding="10dp"
    android:background="@color/white">
    <ImageView
        android:id="@+id/item_mainlv_iv"
        android:layout_width="45dp"
        android:layout_height="45dp"
        android:src="@mipmap/ic_yanjiu_fs"/>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/item_mainlv_iv"
        android:layout_marginLeft="10dp"
        android:orientation="vertical">
        <TextView
            android:id="@+id/item_mainlv_tv_tittle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="烟酒茶"
            android:textStyle="bold"
            android:textSize="16dp"/>
        <TextView
        android:id="@+id/item_mainlv_tv_beizhu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="烟一根"
        android:layout_marginTop="5dp"
        android:textSize="12dp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:orientation="vertical">
        <TextView
            android:id="@+id/item_mainlv_tv_money"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="¥25.0"
            android:textStyle="bold"
            android:textSize="16dp"/>
        <TextView
            android:id="@+id/item_mainlv_tv_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="今天 18:10"
            android:layout_marginTop="5dp" />
    </LinearLayout>


</RelativeLayout>

 

效果图

 

主要就是各个添加,然后描述好他们的位置信息,然后还有添加id等,使他能够更好的进行排版

 

android:id为这个物件添加id
android:layout_width添加厚度
android:layout_height="wrap_content"添加高度
android:text="@string/month_out"添加文本
android:layout_below="@+id/item_mainlv_top_tv1"这个新物件的位置在这个id的下面
android:textSize="26dp"设置文字尺寸
android:textStyle="bold"设置文字是否加粗
android:layout_marginTop="10dp"离上方内容10dp
android:layout_marginBottom="10dp"离下方内容10dp
android:textColor="@color/black"改变文字颜色
android:layout_alignParentRight="true"使这个物件到右边
android:src="@mipmap/ih_show"添加图标
android:layout_alignTop="@id/item_mainlv_top_tv_out" 和他在同一水平线 
android:layout_toRightOf="@+id/item_mainlv_top_tv2"在这个东西右边
android:drawablePadding="10dp" 两者的间距




 

标签:layout,安卓,item,10dp,记账,app,添加,id,android
来源: https://www.cnblogs.com/zhuzhurr/p/15754388.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有