如何轻扫的布局的仅一部分 [英] how to swipe only a portion of the layout

查看:153
本文介绍了如何轻扫的布局的仅一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ViewPagerIndicator库由杰克沃顿商学院,我想有相同的浏览作为火种,很多最近的Andr​​oid应用程序(在谈到首发)的画面......我的意思是布局的只有顶部是swipeable,并在底部的一小部分示出FB /微/ G +登录按钮。

I'm using ViewPagerIndicator Library by Jake Wharton and I'm trying to have the same browsing as Tinder and a lot of recent android apps(Talking about the starting screen)...I mean only the top part of the layout is swipeable, and a smaller part at the bottom shows Fb/Twitter/G+ login buttons.

下面是什么,我希望有一个截图: http://i.imgur.com/QK91rBW巴纽

here is a screenshot of what I wish to have : http://i.imgur.com/QK91rBW.png

我已经阅读此问题的,但我认为这并没有回答我的需要。

I already read this Question, but I think it does not answer my need.

你们能帮助我吗?

推荐答案

嗯,因为你将使用一个ViewPager你不必去想这是swipeable自ViewPager的高度/宽度决定该地区。

Well since you'll be using a ViewPager you don't have to think about the region which is swipeable since the height / width of the ViewPager determines this.

布局例如:

<?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>

结果:

说明:在蓝色区域你把你不改变像Facebook的按钮,在例如静态内容。橙色区域所使用的ViewPagerIndicator和最后的红色区域是ViewPager的之一。由于previously说,只有这方面的swipeable。

Explanation: In the blue region you place your static content which doesn't change like the Facebook-Button in your example. The orange region is used by the ViewPagerIndicator and finally the red region is the one of the ViewPager. As previously said only this area is swipeable.

这篇关于如何轻扫的布局的仅一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆