收入支出界面布局编写

作者:@kuaiquxie
作者的github:https://github.com/bitebita
本文为作者原创,如需转载,请注明出处:https://www.cnblogs.com/dzwj/p/15756073.html


 

在src下新建RecordActivity,layout中会自动新建activity_record.xml文件

复制代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/grey_f3f3f3">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="50dp">
        <ImageView
            android:id="@+id/record_iv_back"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@mipmap/ih_error"
            android:onClick="onClick"
            android:layout_marginLeft="10dp"/>
        <com.google.android.material.tabs.TabLayout
            android:id="@+id/record_tabs"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_centerHorizontal="true"
            app:tabGravity="center"
            app:tabMode="fixed"
            app:tabTextColor="@color/grey_7D7D7D"
            app:tabSelectedTextColor="@color/black"
            app:tabIndicatorColor="@color/black"/>
    </RelativeLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/record_vp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#2196F3" />
</LinearLayout>
复制代码

 

fragment_outcome.xml

复制代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/blue_2196F3">

    <RelativeLayout
        android:id="@+id/frag_record_rl_top"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:padding="10dp">

        <ImageView
            android:id="@+id/frag_record_iv"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@mipmap/ic_qita_fs" />

        <TextView
            android:id="@+id/frag_record_tv_type"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@id/frag_record_iv"
            android:text="其他"
            android:textColor="@color/black"
            android:textSize="16sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/frag_record_et_money"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="46dp"
            android:background="@color/blue_2196F3"
            android:inputType="number" />
    </RelativeLayout>

    <View
        android:id="@+id/frag_record_line1"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@id/frag_record_rl_top"
        android:background="@color/grey_f3f3f3" />

    <GridView
        android:id="@+id/frag_record_gv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/frag_record_line1"
        android:background="@color/blue_2196F3"
        android:numColumns="5"
        android:paddingTop="5dp"
        android:paddingBottom="5dp" />
    <!-- 自定义软键盘-->
    <android.inputmethodservice.KeyboardView
        android:id="@+id/frag_record_keyboard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:keyBackground="@color/grey_f3f3f3"
        android:keyTextColor="@color/black"
        android:paddingTop="1dp"
        android:shadowColor="@color/white"
        android:shadowRadius="0.0" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/frag_record_keyboard"
        android:background="@color/white">

        <TextView
            android:id="@+id/frag_record_tv_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:background="@color/colorPrimaryDark"
            android:padding="10dp"
            android:text="2020年10月30日 18:49"
            android:textColor="@color/black" />

        <TextView
            android:id="@+id/frag_record_tv_beizhu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toLeftOf="@id/frag_record_tv_time"
            android:background="@color/colorPrimary"
            android:padding="10dp"
            android:text="添加备注"
            android:textColor="@color/black" />
    </RelativeLayout>
</RelativeLayout>
复制代码

 

上面写了自定义软键盘,下面是对软键盘的编写(软键盘放在xml包下,key.xml)

复制代码
<?xml version="1.0" encoding="utf-8"?>
<!--keyHeight 每一个按键的高度   keyWidth:每一个按键宽度25% -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:keyHeight="50dp"
    android:keyWidth="25%p"
    android:horizontalGap="1px"
    android:verticalGap="1px">
    <Row>
        <Key android:codes="49" android:keyLabel="1"/>
        <Key android:codes="50" android:keyLabel="2"/>
        <Key android:codes="51" android:keyLabel="3"/>
        <Key android:codes="-5" android:keyLabel="删除"/>
    </Row>
    <Row>
        <Key android:codes="52" android:keyLabel="4"/>
        <Key android:codes="53" android:keyLabel="5"/>
        <Key android:codes="54" android:keyLabel="6"/>
        <Key android:codes="-4" android:keyHeight="150dp" android:keyLabel="确定"/>
    </Row>
    <Row>
        <Key android:codes="55" android:keyLabel="7"/>
        <Key android:codes="56" android:keyLabel="8"/>
        <Key android:codes="57" android:keyLabel="9"/>
    </Row>
    <Row>
        <Key android:codes="-3" android:keyLabel="清零"/>
        <Key android:codes="48" android:keyLabel="0"/>
        <Key android:codes="46" android:keyLabel="."/>
    </Row>
</Keyboard>
复制代码

 

posted @   kuaiquxie  阅读(40)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
点击右上角即可分享
微信分享提示