2016-05-25 4 views
0

In einer Aktivität, die 3 Fragmente enthält, habe ich Auto-ausblenden Symbolleiste Funktion implementiert. Es funktioniert gut, aber ich möchte meine Fortschrittsbalken unbeweglich machen (derzeit geht es aufwärts, während ich die Seite blättern) das selbe für adview. Wie gehe ich vor?Progressbar und Anzeigen statisch (unbeweglich) in NestedScrollView

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView 
android:isScrollContainer="false" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_gravity="fill_vertical" 
android:clipToPadding="false" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:android="http://schemas.android.com/apk/res/android"> 
<RelativeLayout 

xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<ProgressBar 
    android:id="@+id/progressBar3" 
    style="?android:attr/progressBarStyleHorizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="3dip" 
    android:max="100" 
    android:progressDrawable="@drawable/greenprogress" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    /> 

<WebView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/webViewTop" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/progressBar3"/> 

<com.google.android.gms.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true" 
    ads:adSize="BANNER" 
    ads:adUnitId="@string/banner_ad_unit_id"> 
</com.google.android.gms.ads.AdView> 

Ich weiß, dass sie beide in NestedScrollView sind, aber wenn ich NestedScrollView um webview wie folgt enthalten:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:orientation="vertical"> 

<ProgressBar 
    android:id="@+id/progressBar3" 
    style="?android:attr/progressBarStyleHorizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="3dip" 
    android:max="100" 
    android:progressDrawable="@drawable/greenprogress" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    /> 

<android.support.v4.widget.NestedScrollView 
    android:isScrollContainer="false" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="fill_vertical" 
    android:clipToPadding="false" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <WebView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/webViewTop" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/progressBar3"/> 
</android.support.v4.widget.NestedScrollView> 
<com.google.android.gms.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true" 
    ads:adSize="BANNER" 
    ads:adUnitId="@string/banner_ad_unit_id"> 
</com.google.android.gms.ads.AdView> 

</RelativeLayout> 

adview erscheint statisch zu sein. Und der Fortschritt verschwindet vollständig (Erscheint für 1 Sekunde auf dem Bildschirm und ist dann weg).

Danke für Ihre Hilfe.

Antwort

0

Schließlich löste es. Ein lineares Layout wurde erstellt und die Webansicht und die Fortschrittsleiste wurden verschoben.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:orientation="vertical"> 

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

<ProgressBar 
    android:id="@+id/progressBar3" 
    style="?android:attr/progressBarStyleHorizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="3dip" 
    android:max="100" 
    android:progressDrawable="@drawable/greenprogress" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    /> 


<android.support.v4.widget.NestedScrollView 
    android:isScrollContainer="false" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="fill_vertical" 
    android:clipToPadding="false" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <WebView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/webViewTop" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/progressBar3"/> 
</android.support.v4.widget.NestedScrollView> 
</LinearLayout> 


<com.google.android.gms.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true" 
    ads:adSize="BANNER" 
    ads:adUnitId="@string/banner_ad_unit_id"> 
</com.google.android.gms.ads.AdView> 

</RelativeLayout>