- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 88字
- 2021-08-05 10:46:48
Adding UI elements
Now we can start adding some UI elements to do some testing. First, let's update the layout of MainActivity, which is located in res/layout/activity_main.xml. For now, just adding a ProgressBar will do, so let's replace the contents of the ConstraintLayout so that a ProgressBar is located in the middle of the screen:
<android.support.constraint.ConstraintLayout ...>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
By running the application, you will now only see the circular progress bar infinitely spinning. Let's use that spinner to see how the wrong handling of threads can affect the UI.
推薦閱讀
- Android項目開發(fā)入門教程
- C++面向?qū)ο蟪绦蛟O(shè)計(微課版)
- Learning RxJava
- 數(shù)據(jù)結(jié)構(gòu)與算法JavaScript描述
- C語言程序設(shè)計
- TypeScript項目開發(fā)實(shí)戰(zhàn)
- 微服務(wù)架構(gòu)深度解析:原理、實(shí)踐與進(jìn)階
- 好好學(xué)Java:從零基礎(chǔ)到項目實(shí)戰(zhàn)
- PHP編程基礎(chǔ)與實(shí)踐教程
- Go語言從入門到精通
- Python應(yīng)用開發(fā)技術(shù)
- Learning Dynamics NAV Patterns
- TypeScript High Performance
- 生成藝術(shù):Processing視覺創(chuàng)意入門
- Elasticsearch實(shí)戰(zhàn)(第2版)