左手预览是Marshmallow,中间是API 16,最右边是API 21,即Lollipop
请注意,对于低于21的任何内容,进度条会按预期显示,但是在21+上它不仅不会在XML预览中呈现,也不会在最终应用中呈现。我已更新了所有构建工具和库,并在我的gradle构建中定位了最新的API。
项目中的所有代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:orientation="vertical">
<include layout="@layout/tool_bar"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@color/listview_divider"
android:dividerHeight="1dp"
android:id="@+id/listView"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar2"
android:layout_gravity="center"/>
</FrameLayout>
</LinearLayout>