官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 四子王旗| 政和县| 叶城县| 乌拉特前旗| 宁德市| 招远市| 邹城市| 尉犁县| 旬邑县| 惠水县| 龙州县| 皋兰县| 永仁县| 阿克陶县| 内丘县| 瓦房店市| 嘉善县| 肇州县| 潜山县| 友谊县| 和平区| 博乐市| 资源县| 三都| 祥云县| 文山县| 温州市| 和龙市| 牙克石市| 千阳县| 台州市| 南阳市| 元氏县| 黑水县| 庐江县| 尖扎县| 忻州市| 弋阳县| 台东县| 长治县| 永胜县|