Android的标签式活动下关闭屏幕 [英] Android Tabbed Activity Bottom off Screen

查看:273
本文介绍了Android的标签式活动下关闭屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个想法,为什么底部是关闭屏幕在Android中新生成的标签活动?

新活动

ViewPager是整个屏幕

过长

 < android.support.v4.view.ViewPager
    机器人:ID =@ + ID /容器
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    应用:layout_behavior =@字符串/ appbar_scrolling_view_behavior/>

集装箱太长

结果在孩子碎片的观点,都是戏外的55dp如果它们对齐到屏幕的底部。

谢谢,

在生成code的P.S:完整的XML:

 <?XML版本=1.0编码=UTF-8&GT?;
< android.support.design.widget.CoordinatorLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:程序=htt​​p://schemas.android.com/apk/res-auto
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    机器人:ID =@ + ID / main_content
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:fitsSystemWindows =真
    工具:上下文=com.comfylight.bulbtest.FooBar>    < android.support.design.widget.AppBarLayout
        机器人:ID =@ + ID / appbar
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:paddingTop =@扪/ appbar_padding_top
        机器人:主题=@风格/ AppTheme.NoActionBar.AppBarOverlay>        < android.support.v7.widget.Toolbar
            机器人:ID =@ + ID /工具栏
            机器人:layout_width =match_parent
            机器人:layout_height =?ATTR / actionBarSize
            机器人:ATTR / colorPrimary背景=
            应用:layout_scrollFlags =滚动| enterAlways
            应用:popupTheme =@风格/ AppTheme.NoActionBar.PopupOverlay>        < /android.support.v7.widget.Toolbar>        < android.support.design.widget.TabLayout
            机器人:ID =@ + ID /标签
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT/>    < /android.support.design.widget.AppBarLayout>    < android.support.v4.view.ViewPager
        机器人:ID =@ + ID /容器
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        应用:layout_behavior =@字符串/ appbar_scrolling_view_behavior/>    < android.support.design.widget.FloatingActionButton
        机器人:ID =@ + ID / FAB
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_gravity =结束|底
        机器人:layout_margin =@扪/ fab_margin
        机器人:SRC =@机器人:可绘制/ ic_dialog_email/>< /android.support.design.widget.CoordinatorLayout>


解决方案

也许这样的设计会在你需要什么帮助,加上:

 <的LinearLayout
        机器人:ID =@ + ID /测试
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:方向=垂直>
< / LinearLayout中>

在你的XML:

 <?XML版本=1.0编码=UTF-8&GT?;
< android.support.design.widget.CoordinatorLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:程序=htt​​p://schemas.android.com/apk/res-auto
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    机器人:ID =@ + ID / main_content
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:fitsSystemWindows =真
    工具:上下文=com.comfylight.bulbtest.FooBar>    <的LinearLayout
                机器人:ID =@ + ID /测试
                机器人:layout_width =match_parent
                机器人:layout_height =match_parent
                机器人:方向=垂直>    < android.support.design.widget.AppBarLayout
        机器人:ID =@ + ID / appbar
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:paddingTop =@扪/ appbar_padding_top
        机器人:主题=@风格/ AppTheme.NoActionBar.AppBarOverlay>        < android.support.v7.widget.Toolbar
            机器人:ID =@ + ID /工具栏
            机器人:layout_width =match_parent
            机器人:layout_height =?ATTR / actionBarSize
            机器人:ATTR / colorPrimary背景=
            应用:layout_scrollFlags =滚动| enterAlways
            应用:popupTheme =@风格/ AppTheme.NoActionBar.PopupOverlay>        < /android.support.v7.widget.Toolbar>        < android.support.design.widget.TabLayout
            机器人:ID =@ + ID /标签
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT/>    < /android.support.design.widget.AppBarLayout>    < android.support.v4.view.ViewPager
        机器人:ID =@ + ID /容器
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        应用:layout_behavior =@字符串/ appbar_scrolling_view_behavior/>    < android.support.design.widget.FloatingActionButton
        机器人:ID =@ + ID / FAB
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_gravity =结束|底
        机器人:layout_margin =@扪/ fab_margin
        机器人:SRC =@机器人:可绘制/ ic_dialog_email/>    < / LinearLayout中>
< /android.support.design.widget.CoordinatorLayout>

anybody an idea why the bottom is off screen in a new generated tabbed activity in android?

ViewPager is too long for the total screen

    <android.support.v4.view.ViewPager
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

Result all views in the child Fragments are off screen by the 55dp if you align them to the bottom of the screen.

Thanks,

Paul

P.S.: Full XML of the generate code:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.comfylight.bulbtest.FooBar">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/appbar_padding_top"
        android:theme="@style/AppTheme.NoActionBar.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay">

        </android.support.v7.widget.Toolbar>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

解决方案

Maybe this design will help in what you need, add:

<LinearLayout
        android:id="@+id/test"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
</LinearLayout>

in your xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.comfylight.bulbtest.FooBar">

    <LinearLayout
                android:id="@+id/test"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/appbar_padding_top"
        android:theme="@style/AppTheme.NoActionBar.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay">

        </android.support.v7.widget.Toolbar>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

这篇关于Android的标签式活动下关闭屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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