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

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.

主站蜘蛛池模板: 景洪市| 镇平县| 南开区| 西青区| 玛曲县| 沅陵县| 贵州省| 昌江| 宕昌县| 天长市| 吉安县| 子洲县| 轮台县| 永昌县| 日土县| 广平县| 藁城市| 东方市| 信丰县| 蒙阴县| 镇安县| 湟源县| 威远县| 望城县| 甘洛县| 保靖县| 德阳市| 嵊州市| 赤城县| 永寿县| 高尔夫| 定陶县| 平乡县| 抚远县| 深圳市| 上杭县| 扬州市| 张家界市| 濮阳县| 罗甸县| 修文县|