[英]Android Studio - ProgressBar will not render
I am attempting to use a progressbar within my layout. 我正在尝试在布局中使用进度条。 I do not understand why it will not render. 我不明白为什么它不会渲染。 It doesn't show in my preview and it also doesn't show when I run the app through my actual phone. 当我通过实际的手机运行该应用程序时,它不会显示在预览中,也不会显示。 Any ideas why this would happen? 任何想法为什么会发生这种情况?
Here is my layout XML: 这是我的布局XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="#283341"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_startup" tools:context=".StartupActivity">
<ImageView
android:id="@+id/startupImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="150dp"
android:layout_centerInParent="true"
android:src="@drawable/q_orange" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="30dp">
<ProgressBar
android:id="@+id/loadingSpinner"
style="?android:attr/progressBarStyleSmall"
android:layout_centerInParent="true"
android:layout_width="33dp"
android:layout_height="33dp"
android:visibility="visible"
android:indeterminate="true"
/>
<TextView
android:id="@+id/startupStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Loading..."
android:textColor="#ff8a07"
android:textSize="25sp" />
</LinearLayout>
</RelativeLayout>
Try this and let me know whether it works or not : 试试这个,让我知道它是否有效:
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@android:style/Widget.ProgressBar.Small"
android:layout_marginRight="5dp" />
set for progressbar 设置进度条
android:layout_width="100dp"
android:layout_height="wrap_content"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.