本文介绍了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:机器人=http://schemas.android/apk/res/android 的xmlns:程序=http://schemas.android/apk/res-auto 的xmlns:工具=http://schemas.android/tools 机器人:ID =@ + ID / main_content 机器人:layout_width =match_parent 机器人:layout_height =match_parent 机器人:fitsSystemWindows =真 工具:上下文=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:机器人=http://schemas.android/apk/res/android 的xmlns:程序=http://schemas.android/apk/res-auto 的xmlns:工具=http://schemas.android/tools 机器人:ID =@ + ID / main_content 机器人:layout_width =match_parent 机器人:layout_height =match_parent 机器人:fitsSystemWindows =真 工具:上下文=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="schemas.android/apk/res/android" xmlns:app="schemas.android/apk/res-auto" xmlns:tools="schemas.android/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="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="schemas.android/apk/res/android" xmlns:app="schemas.android/apk/res-auto" xmlns:tools="schemas.android/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="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的标签式活动下关闭屏幕
发布评论