0
我有一個ViewPager
(標準的一個),它被放在ScrollView
(萬一頁面將會變大然後屏幕顯示,每個頁面上我都有一個Spinner
(進度條)用於顯示數據加載,Spinner
以頁面爲中心如何在ViewPager頁面大於屏幕的同時在屏幕上居中顯示?
但是當頁面更大然後篩選Spinner
不集中在屏幕上,因爲它爲中心的網頁上,並Spinner
在屏幕下方(或者竟然隱藏,例如在屏幕下方)。
那麼如何設置Spinner
中心屏幕上(不在頁面上)?
更新:微調必須在viewpager的頁面上,因爲每個頁面都必須加載一些數據表單服務器,微調器分別指示每個頁面的加載過程。
這裏是尋呼機的位置:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" />
</LinearLayout>
這裏是一個頁面佈局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true">
<GridView
android:id="@+id/my_gird"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="72dp"/>
<TextView
android:id="@+id/test_text"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="!!!!!!" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
</RelativeLayout>
它不能解決我的問題,因爲我必須訪問查看尋呼機上的進度條表單頁面。 – LunaVulpo
@LunaVulpo你不能提供回調嗎? – Shark
@Shark也許我可以,但最後我通過編程方式測量屏幕尺寸並將progressBar設置在正確的位置來解決我的問題。 – LunaVulpo