2016-07-20 1 views
0

하나의 레이아웃 파일에서 진행률 막대와 스 와이프 할 수있는 웹보기를 보여주고 싶습니다. 스 와이프 레이아웃을 구현하면 진행 표시 줄이 자동으로 사라지고 표시 할 수 없습니다.스 와이프 레이아웃에서 안드로이드 진행 표시 줄 보이지 않음

무엇이 문제입니까?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:mlns="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.xy.MainActivity"> 

    <ProgressBar 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/progressBarCenter" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true" 
    android:visibility="visible" 
    android:background="#ff0303" /> 

<android.support.v4.widget.SwipeRefreshLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:mlns="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/swiper" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.xy.MainActivity"> 

    <WebView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/webView" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 
</android.support.v4.widget.SwipeRefreshLayout> 
</RelativeLayout> 

답변

1

SwipeRefreshLayoutProgressBar을 덮고 있기 때문이다. RelativeLayout에서 Xml의 아래쪽 아래쪽은 Z 축에서 위로 올라간 것을 의미합니다.

주문을 취소해야합니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:mlns="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.xy.MainActivity"> 

    <android.support.v4.widget.SwipeRefreshLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     xmlns:mlns="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/swiper" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context="com.xy.MainActivity"> 

     <WebView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/webView" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" /> 
    </android.support.v4.widget.SwipeRefreshLayout> 

    <ProgressBar 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/progressBarCenter" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:visibility="visible" 
     android:background="#ff0303" /> 
</RelativeLayout>