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

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.

主站蜘蛛池模板: 高密市| 台湾省| 荥阳市| 麻栗坡县| 新邵县| 固镇县| 镇原县| 南康市| 鸡西市| 拉孜县| 安泽县| 麻栗坡县| 迁西县| 磐石市| 昂仁县| 伊吾县| 西乌珠穆沁旗| 黄龙县| 卓尼县| 长春市| 巨野县| 修武县| 阆中市| 基隆市| 镇雄县| 牟定县| 南部县| 衡山县| 平阳县| 宝坻区| 教育| 娱乐| 吉木乃县| 云南省| 墨竹工卡县| 手游| 高邑县| 乐平市| 和林格尔县| 新乐市| 武陟县|