我想在呼叫API時在螢屏上顯示一個進度條。創建了如下的API,但是一旦它可見,就會顯示在按鈕/文本欄位的后面。如果螢屏上沒有專案,它就完全可見。如果有按鈕或其他東西,它就顯示在按鈕的后面。所以我不能正確地看到它。請讓我知道,如果在實作上有什么問題。
<?xml version="1.0" encoding="utf-8"? >
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"/span>
xmlns:app="http://schemas.android.com/apk/res-auto"。
xmlns:tools="http://schemas.android.com/tools"。
android:layout_width="match_parent"。
android:layout_height="match_parent"。
android:fillViewport="true"
>
<androidx.constraintlayout.widget.ConstraintLayout。
android:layout_width="match_parent"
android:layout_height="wrap_content"。
android:id="@ id/window_layout"。
android:background="@color/white"
>
<FrameLayout>
android:id="@ id/linearLayout5"/span>
android:layout_width="match_parent"。
android:layout_height="match_parent"/span>>
<LinearLayout。
android:id="@ id/progress_linear"/span>
android:layout_width="match_parent"。
android:layout_height="match_parent"。
android:gravity="center"。
android:orientation="vertical">
<ProgressBar。
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"。
android:indeterminate="true"。
android:theme="@style/ProgressBarTheme"。
android:id="@ id/progress"。
android:layout_gravity="center"/span> />
</LinearLayout>
<LinearLayout
android:orientation="vertical"。
android:layout_marginLeft="20dp"/span>
android:layout_marginRight="20dp"。
android:layout_width="match_parent"。
android:layout_height="wrap_content"。
tools:ignore="MissingConstraints"/span>>
<TextView。
android:layout_width="match_parent"。
android:layout_height="wrap_content"。
android:layout_marginTop="24dip"。
android:text="@string/txt_setup"。
android:layout_marginBottom="16dp"。
/><RelativeLayout。
android:layout_width="match_parent"/span>
android:layout_height="42dp"。
android:layout_marginTop="8dp"。
android:id="@ id/spinner_layout"
android:background="@drawable/spinner_back">
<Spinner。
android:id="@ id/spinner"
android:layout_width="match_parent"。
android:layout_height="match_parent"。
android:dropDownWidth="match_parent"。
android:dropDownVerticalOffset="40dp"。
android:background="@android:color/transparent"。
android:spinnerMode="dropdown" />
<ImageView
android:id="@ id/spinner_arr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"。
android:layout_gravity="center"。
android:src="@drawable/ic__2_web_icons_ic_caretdown_gra"/span>/>
</RelativeLayout>
</LinearLayout>/span>
</FrameLayout>/span>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>/span>
uj5u.com熱心網友回復:
你有沒有試過:
<LinearLayout。
android:id="@ id/progress_linear"/span>
android:layout_width="match_parent"。
android:layout_height="match_parent"。
android:gravity="center"。
android:orientation="vertical"
android: elevation="1dp">
<ProgressBar。
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"。
android:indeterminate="true"。
android:theme="@style/ProgressBarTheme"。
android:id="@ id/progress"。
android:layout_gravity="center"/span> />
</LinearLayout>
這可能會把這個布局帶到前面來
android:translationZ="1dp"/span>
也有可能作業
uj5u.com熱心網友回復:你可能想閱讀一下FrameLayout的作業原理,但通常對于FrameLayout中的每個子視圖,層次結構底部的那個將被顯示在上面。因此,對于你的情況,你需要做如下的改變
<FrameLayout
android:id="@ id/linearLayout5"/span>
android:layout_width="match_parent"。
android:layout_height="match_parent"/span>>
<LinearLayout。
android:orientation="vertical"。
android:layout_marginLeft="20dp"/span>
android:layout_marginRight="20dp"。
android:layout_width="match_parent"。
android:layout_height="wrap_content"。
tools:ignore="MissingConstraints"/span>>
<TextView。
android:layout_width="match_parent"。
android:layout_height="wrap_content"。
android:layout_marginTop="24dip"。
android:text="@string/txt_setup"。
android:layout_marginBottom="16dp"。
/><RelativeLayout。
android:layout_width="match_parent"/span>
android:layout_height="42dp"。
android:layout_marginTop="8dp"。
android:id="@ id/spinner_layout"
android:background="@drawable/spinner_back">
<Spinner。
android:id="@ id/spinner"
android:layout_width="match_parent"。
android:layout_height="match_parent"。
android:dropDownWidth="match_parent"。
android:dropDownVerticalOffset="40dp"。
android:background="@android:color/transparent"。
android:spinnerMode="dropdown" />
<ImageView
android:id="@ id/spinner_arr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"。
android:layout_gravity="center"。
android:src="@drawable/ic__2_web_icons_ic_caretdown_gra"/span>/>
</RelativeLayout>
</LinearLayout>/span>
<LinearLayout
android:id="@ id/progress_linear"/span>
android:layout_width="match_parent"。
android:layout_height="match_parent"。
android:gravity="center"。
android:orientation="vertical">
<ProgressBar。
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"。
android:indeterminate="true"。
android:theme="@style/ProgressBarTheme"。
android:id="@ id/progress"。
android:layout_gravity="center"/span> />
</LinearLayout>
</FrameLayout>/span>
注意到我是如何將你的progress_linear LinearLayout移到FrameLayout的底部的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/313051.html
標籤:
