2014-07-08 3 views
1

Jake Wharton이 ViewPagerIndicator 라이브러리를 사용하고 있는데 Tinder와 많은 최신 안드로이드 앱 (시작 화면에 대해 말하기)과 동일한 브라우징을하려고합니다 ... 레이아웃의 윗부분 만 스 와이프 할 수 있으며 하단의 작은 부분에는 Fb/Twitter/G + 로그인 버튼이 표시됩니다. 여기 레이아웃의 일부만 스 와이프하는 방법

내가 얻고 자하는 것을의 스크린 샷입니다 : 이미이 Question을 읽을 http://i.imgur.com/QK91rBW.png

,하지만 난 내 필요에 응답하지 않습니다 생각합니다.

제발 도와 주실 수 있습니까?

답변

1

ViewPager를 사용하기 때문에 ViewPager의 높이/너비가이를 결정하기 때문에 스 와이프 할 수있는 영역에 대해 생각할 필요가 없습니다.

레이아웃 예 :

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

    <!-- Static content --> 
    <LinearLayout 
     android:id="@+id/ll_bottom" 
     android:layout_width="match_parent" 
     android:layout_height="100dp" 
     android:layout_alignParentBottom="true" 
     android:background="@color/holo_blue_light" 
     android:orientation="vertical" /> 

    <!-- ViewPager Indicator --> 
    <com.viewpagerindicator.LinePageIndicator 
     android:id="@+id/view_pager_indicator" 
     android:layout_width="fill_parent" 
     android:layout_height="20dp" 
     android:layout_above="@id/ll_bottom" 
     android:background="@color/holo_orange_light" 
     app:lineWidth="10dp" 
     app:selectedColor="#fff" 
     app:strokeWidth="10dp" 
     app:unselectedColor="#888888" /> 

    <!-- ViewPager containing fragments with different views --> 
    <android.support.v4.view.ViewPager 
     android:id="@+id/view_pager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@id/view_pager_indicator" 
     android:layout_alignParentTop="true" 
     android:background="@color/holo_red_light" /> 

</RelativeLayout> 

결과 :

enter image description here

설명 : 청색 영역에서 당신은 당신의 예에서 페이스 북-버튼처럼 변경되지 않는 정적 콘텐츠를 배치합니다. 주황색 영역은 ViewPagerIndicator에 의해 사용되며, 마지막으로 빨간색 영역은 ViewPager 중 하나입니다. 이전과 마찬가지로이 영역 만 스 와이프 할 수 있습니다.

+0

감사합니다. 당신은 생명의 은인입니다! – RidRoid

관련 문제