HUSTEN
HUSTEN

Reputation: 5197

How can I put progress bar component on top of the layout?

Now, it's showing progress bar in the middle of vertical line.
I want it on the top of the screen(above the webview)

I tried to switch Progress bar part and webview, but it made progress bar invisible.
How can I show progress bar on top of layout?

and if possible, how can I change the height of progress bar to make it look thicker?

Thanks!

My current code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    tools:context=".MainActivity" >




    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <FrameLayout
    android:id="@+id/ProgressBarWrapper01"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:visibility="gone"
    android:paddingLeft="1dip"
    android:paddingRight="1dip">

        <ProgressBar
            android:id="@+id/ProgressBar01"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        </ProgressBar>
    </FrameLayout>

<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>

</RelativeLayout>

Upvotes: 0

Views: 2920

Answers (1)

Dong Xiabin
Dong Xiabin

Reputation: 171

Q1: Remove android:layout_centerInParent="true" from your FrameLayout.
Q2: You can set a value such as android:layout_height="5dip" to your ProgressBar.

Upvotes: 1

Related Questions