关于制作习惯养成打卡仿uhabit的app

由于是刚接触android studio 开发,就选择了一个比较简单的uhabit开源软件,我写的跟开源软件里面的代码有很大的不同,但设计的功能,我是努力想做的跟uhabit相似的。但是最后还有好多没有完成。

在写的过程中遇到了很多问题

1.首先是对于一些文件的使用,比如style文件,是自己要添加东西进去然后供自己调用的,@style。。。之类的。

2.对于一些布局,当时没有好好看,在设计界面的时候吃亏了,比如LinearLayout是线性布局,所以对于android:layout_above之类的摆放位置的就不能用了,还有一点不同的是,因为在网上百度demo的时候,一直看到的是<RealitiveLayout,所以可以用

android :layout_above=",但是自己添加一个layout文件时系统自动定义的

<android.support.constraint.ConstraintLayout

这种情况下,就是用

app:layout_constraintTop_toBottomOf="@+id/edit_text1"形式。

3.对于设计一个好看的button,一直想把button变成没有棱角的,还有自定义的图片。

首先是设置一个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="com.example.jm.demo.register" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="50dip"
        android:text="hello_world"
        android:paddingTop="20dp"
        android:paddingRight="20dp"
        android:paddingLeft="20dp"
        android:paddingBottom="20dp"
        android:background="@drawable/shape_world"/>

</RelativeLayout>

效果图

 

其中的shape_world帮我实现了我想要的很多东西,比如背景,还有一个比较圆的button。

shape_worid是写在drawable下面的一个文件

<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item&
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值