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

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.

主站蜘蛛池模板: 琼海市| 汉源县| 临猗县| 固阳县| 商河县| 沈丘县| 桓仁| 陵水| 六枝特区| 隆回县| 扬中市| 泸定县| 苏尼特右旗| 晋江市| 渭源县| 长春市| 陆丰市| 临朐县| 富锦市| 东港市| 滨州市| 景宁| 广饶县| 多伦县| 景谷| 扶绥县| 丽水市| 五华县| 合山市| 婺源县| 泰兴市| 梅河口市| 军事| 崇左市| 天气| 中牟县| 兴业县| 白水县| 合作市| 五峰| 夏津县|