Ber*_*rsh 11 android android-progressbar
我用我的片段替换了简单ProgressBar的ContentLoadingProgressBar.现在片段布局如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/simple_match_parent_style">
<android.support.v4.widget.ContentLoadingProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/txt_no_songs"
android:text="@string/txt_no_songs"
android:layout_centerInParent="true"
style="@style/txt_no_songs"/>
<ListView
android:id="@+id/list"
android:fastScrollEnabled="true"
android:divider="@null"
style="@style/simple_match_parent_style"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我将此ProgressBar显示在onViewCreated:
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
progressBar = (ContentLoadingProgressBar) view.findViewById(R.id.progress);
progressBar.show();
...
}
Run Code Online (Sandbox Code Playgroud)
出于测试目的,我已删除progressBar.hide()调用以使ProgressBar出现在任何情况下.但问题是我ContentLoadingProgressBar从未真正展示过.
我应该做些别的事ContentLoadingProgressBar吗?我没有设法找到任何相关的使用示例,ContentLoadingProgressBar因此任何有用的示例也是可取的.提前致谢.
dte*_*ten 21
看起来你需要一种风格,例如......
style="?android:attr/android:progressBarStyleHorizontal"
Run Code Online (Sandbox Code Playgroud)
如果我把它放在那里,对我来说很有用,没有我什么都看不到.
还要考虑将它放在你的内容之上(即在xml下面)
小智 7
我试过这个:
<android.support.v4.widget.ContentLoadingProgressBar
android:id="@+id/address_looking_up"
style="?android:attr/android:progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="visible" />
Run Code Online (Sandbox Code Playgroud)
但是,它在Android 5.0上无效.有关ContentLoadingProgressbar的更多详细信息应该在这里.
PS:好的,"风格"的属性在这里很重要.将样式更改为" ?android:attr/progressBarStyleLarge "并且它可以正常工作.
同时,此小部件的显示效果取决于您的应用程序的主题.
| 归档时间: |
|
| 查看次数: |
9829 次 |
| 最近记录: |