AlertDialog.Builder(context)
.setView(0)
.setTitle(R.string.dialog_title)
.setMessage(R.string.dialog_message)
.setIcon(0)
.create()
UI布局中的控件一定要密密麻麻
💩 UI布局中控件嵌套应越多越多,这样才能体现自己的逻辑思考能力⛲
Good 👍🏻
<RelativeLayout>
<LinearLayout>
<RelativeLayout>
<ImageView/>
...
<TextView/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
Bad 👎🏻
<android.support.constraint.ConstraintLayout>
<ImageView/>
...
<TextView/>
</android.support.constraint.ConstraintLayout>
编写你不会使用的代码
💩 做人要未雨绸缪,写代码也是一样,要编写自己不使用的代码为未来做打算📬
Good 👍🏻
fun countPrimes(n:Int,count:Int): Int {
var sum = 9527