android实现过程,Android:一个完整app开发流程
一.給出功能文檔
二.APP架構選擇
可選MVP,MVVM
三.APP目錄結構設置
本app基于mvp架構。除了mvp架構的文件。
還包含下面的文件夾:
ui (下面根據Activity劃分)
widget (自定義dialog等)
base (BaseActivity,BaseFragment)
四.劃分Activity與Fragment
有側滑欄,tab的一般用fragment
五.分辨率適配
設置sw-360dp,sw-480dp等不同的dimension目錄,根據百分比計算dp值。
image.png
六.三方庫使用
bindview使用butterknife,不同組件通信使用EventBus,定時使用RxJava,崩潰收集bugly
七.自定義view
按鈕樣式:
使用selector
按鈕背景色,包括顏色和圓角
android:shape="rectangle">
八.布局方式
使用ConstraintLayout,直接使用標注的值來做,最簡單,不要用百分比。使用layout_constraint,layout_margin完成所有布局。
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:paddingBottom="@dimen/dp_24_dp"
android:layout_height="wrap_content"
android:background="@drawable/base_bg_dialog1">
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="@dimen/dp_24_dp"
android:layout_marginEnd="8dp"
android:text="@string/tip"
android:textSize="@dimen/sp_20_sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="@dimen/dp_24_dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="@dimen/dp_24_dp"
android:textSize="@dimen/sp_19_sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24_dp"
android:layout_marginRight="@dimen/dp_60_dp"
android:padding="@dimen/dp_10_dp"
android:text="@string/cancel"
android:background="@drawable/bg_text_button2"
android:textSize="@dimen/sp_19_sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_sure"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_content" />
android:id="@+id/tv_sure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24_dp"
android:padding="@dimen/dp_10_dp"
android:text="@string/sure"
android:textSize="@dimen/sp_19_sp"
android:background="@drawable/bg_text_button2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/tv_cancel"
app:layout_constraintTop_toBottomOf="@+id/tv_content" />
在AndroidStudio直接肉眼布局,Android可以選擇不同的分辨率機器,水平或者垂直進行預覽
肉眼布局法
九.編譯系統配置
配置sdk版本
配置abi
十.圖片配置
使用藍湖進行圖片的協助。提供m,h,x,xx等不同分辨率的圖片
image.png
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的android实现过程,Android:一个完整app开发流程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言为正数无限大,无限大整数相加算法的
- 下一篇: 谷歌首提Android11,谷歌官方首次