首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >在两个ViewPager小部件的交界处添加fab按钮

在两个ViewPager小部件的交界处添加fab按钮
EN

Stack Overflow用户
提问于 2015-07-08 14:50:23
回答 1查看 189关注 0票数 1

我已经实现了一个导航抽屉。在导航的FrameLayout抽屉中,我添加了一个包含2个ViewPagers的片段,每个片段恰好占据半个屏幕。现在,我想在这两个视图寻呼机的交界处添加一个FAB按钮,如下所示。

在我的例子中,两个视图寻呼机恰好占据了半个屏幕,这与图像中显示的略有不同。有没有人能帮我把车开到路口。

包含两个视图寻呼机的片段代码如下:

代码语言:javascript
代码运行次数:0
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/shirt_section"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="0dp" />

    <android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/pant_section"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="0dp" />
</LinearLayout>  
EN

回答 1

Stack Overflow用户

发布于 2015-07-08 15:27:41

您可以将线性布局封装到FrameLayout中,然后添加按钮,如下所示:

代码语言:javascript
代码运行次数:0
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent">

          ...
    </LinearLayout>  
    <ImageButton
        android:layout_gravity="center_vertical|right"
        ...
    />
</FrameLayout>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31285428

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档