主体思路
最近又接到安卓开发的任务要求,需要设计一个app的大致框架,需要带上首页,列表页,详情页。
作为一个安全小鸡仔,肯定少不了想做一个和安全相关的app。因此大致思路就是依附于国外著名安全网站thm,做一个安全wiki 。
首页
主页加载gif
具体展示

实现过程
首页操作
1 2 3 4 5 6 7
| build.gradle 中加载
dependencies { implementation 'com.github.bumptech.glide:glide:4.15.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.15.0' }
|

按钮加载一个渐变色
在drawble中创建一个xml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#6A82FB" android:endColor="#FC5C7D" android:angle="45" android:type="linear"/> <corners android:radius="16dp"/> <padding android:left="20dp" android:top="12dp" android:right="20dp" android:bottom="12dp"/> </shape>
|
在按钮中加载
android:background=”@drawable/gradient_button”
音乐
普通服务直接使用mediaPlayer 创建音乐
1 2 3 4
| mediaPlayer=MediaPlayer.create(this, R.raw._apt) ; if (!mediaPlayer.isPlaying()){ mediaPlayer.start(); }
|
列表页
首页跳转列表页
列表页采用三个按钮分别跳转
详情页面
framelayout 可以作为一个容器 展示fragment
1 2 3 4 5 6
| <FrameLayout android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" />
|
放置三个容器,分别注册三个fragment之后可以进行操作。
之后加入退回到堆栈的代码,就可以通过返回返回上一页
1 2 3 4 5
| transaction.addToBackStack(null);
transaction.commit();
|
源码地址
https://github.com/k1t0111/app