2014-12-17 5 views
2

부동 Button 용 SwipeRefreshLayout 및 세 가지 TableLayouts가있는 scrollview를 구현하려고합니다. 머티리얼 디자인을 사용하는 Gmail 앱과 같이 항상 플로팅 버튼을 화면에 표시하고 싶습니다. 안타깝게도 스 와이프 새로 고침은 스크롤 업을 차단합니다. 내 scrollview가 위로 스크롤하려는 스 와이프 새로 고침을 알리는 방법은 무엇입니까? 레이아웃 구조를 변경해야합니까? 당신은 당신의 SwipeRefreshLayout에 대한 프로그래밍 canChildScrollUp() 메소드를 오버라이드 (override) 할 필요가ScrollView 및 FloatingActionButton을 사용하여 SwipeRefresh

<android.support.v4.widget.SwipeRefreshLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:fab="http://schemas.android.com/apk/res-auto" 
android:id="@+id/swipe_container" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

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

      <TableLayout 
       android:id="@+id/table_recent_claims" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"></TableLayout> 

      <TableLayout 
       android:id="@+id/table_recent_rapidscans" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"></TableLayout> 

      <TableLayout 
       android:id="@+id/table_recent_journeys" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"></TableLayout> 
     </LinearLayout> 
    </ScrollView> 

    <com.getbase.floatingactionbutton.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     fab:fab_icon="@drawable/fab_plus24" /> 
</FrameLayout> 
</android.support.v4.widget.SwipeRefreshLayout> 

답변

0

: 나는 도서관을 여기 https://github.com/futuresimple/android-floating-action-button

을 사용하고

내 레이아웃입니다. 각각의 경우는 SwipreRefreshLayout 아래에있는 자녀보기에 따라 다릅니다.

또한, 나는 FrameLayout가 귀하의 경우 불필요하고 ScrollView

구글의 스크롤 기능을 차단 할 수 올바르게 SwipeRefreshLayout을 구현하는 데 사용할 수있는 자원과 코드를 모두에 대한 몇 가지 샘플을 제공하고 있다고 생각 :

한보기 : https://developer.android.com/samples/SwipeRefreshListFragment/index.html

여러보기 : https://developer.android.com/samples/SwipeRefreshMultipleViews/index.html