簡體   English   中英

Android Studio-ProgressBar將無法呈現

[英]Android Studio - ProgressBar will not render

我正在嘗試在布局中使用進度條。 我不明白為什么它不會渲染。 當我通過實際的手機運行該應用程序時,它不會顯示在預覽中,也不會顯示。 任何想法為什么會發生這種情況?

這是我的布局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>

在Android Studio中預覽

試試這個,讓我知道它是否有效:

     <ProgressBar
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     style="@android:style/Widget.ProgressBar.Small"
     android:layout_marginRight="5dp" />

設置進度條

android:layout_width="100dp"
android:layout_height="wrap_content"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM