gpt4 book ai didi

android - 相对布局中心的进度条

转载 作者:行者123 更新时间:2023-11-29 14:18:49 25 4
gpt4 key购买 nike

<?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="wrap_content"
android:layout_marginTop="?android:attr/actionBarSize"
android:background="@drawable/stalker_background"
android:focusableInTouchMode="true" >


<ProgressBar
android:id="@+id/pb"
android:layout_height="75dp"
android:layout_width="75dp"
android:layout_gravity="center"
android:indeterminate="true"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<ScrollView
android:id="@+id/svProfile"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<android.support.v4.view.ViewPager
android:id="@+id/VPSlider"
android:layout_width="match_parent"
android:layout_height="175dp"
/>


<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" />

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>

</android.support.v4.app.FragmentTabHost>

</LinearLayout>
</ScrollView>
</LinearLayout>

</RelativeLayout>

进度条出现在屏幕的一角,如何将其对齐到屏幕的中心。我有相对布局,在我有一些东西要在屏幕上显示后我要删除这个进度条,这就是为什么我需要它在其他控件之上。

最佳答案

试试这个..

android:layout_centerInParent="true" 添加到您的 ProgressBar 因为您的父布局是 RelativeLayout

<ProgressBar 
android:id="@+id/pb"
android:layout_height="75dp"
android:layout_width="75dp"
android:layout_gravity="center"
android:indeterminate="true"
android:layout_centerInParent="true"
/>

关于android - 相对布局中心的进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25461644/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com