滚动型里面加上TabLayout片段不滚动,为什么呢? [英] ScrollView inside a fragment with TabLayout is not scrolling, why?
问题描述
即时通讯在Android开发一个菜鸟,我是在密码学的介绍当然,所以我决定两者结合起来,使这个应用程序。我用一个TabLayout制作一个标签为每个加密方法(RSA和XOR),以及一个标签为指导和帮助。一切都完美地工作,直到我在帮助选项卡中添加滚动型的说明。滚动视图不滚动,而且我不知道为什么,我一直在寻找的网站寻求帮助,做这样的改变每一个解决方案,更多钞票的宽度的高度滚动型的属性,我很坚持,你能帮助我吗?
截图
编辑----- ----- 16年3月2日
**我main_activity.xml **
<?XML版本=1.0编码=UTF-8&GT?;
< android.support.design.widget.CoordinatorLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:程序=http://schemas.android.com/apk/res-auto
的xmlns:工具=http://schemas.android.com/tools
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:fitsSystemWindows =真
工具:上下文=com.example.usuario.chatparritos.MainActivity> < android.support.design.widget.AppBarLayout
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:主题=@风格/ ThemeOverlay.AppCompat.Dark.ActionBar>
< android.support.v7.widget.Toolbar
机器人:ID =@ + ID /工具栏
机器人:layout_width =match_parent
机器人:layout_height =?ATTR / actionBarSize
机器人:ATTR / colorPrimary背景=
机器人:海拔=4DP
机器人:主题=@风格/ ThemeOverlay.AppCompat.ActionBar
应用:popupTheme =@风格/ ThemeOverlay.AppCompat.Light/> < android.support.design.widget.TabLayout
机器人:ID =@ + ID / tab_layout
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_below =@ + ID /工具栏
机器人:ATTR / colorPrimary背景=
机器人:海拔=6DP
安卓了minHeight =?ATTR / actionBarSize
应用:tabMode =固定
机器人:主题=@风格/ ThemeOverlay.AppCompat.Dark.ActionBar/> < android.support.v4.view.ViewPager的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:工具=http://schemas.android.com/tools
机器人:ID =@ + ID /寻呼机
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:layout_below =@ + ID /工具栏
工具:上下文=net.voidynullness.android.tabitytabs.TabLayoutActivity
机器人:背景=#FFFFFF/> < /android.support.design.widget.AppBarLayout>
< 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_info/>< /android.support.design.widget.CoordinatorLayout>
----- //编辑16年3月2日-----
这是我tab_fragment_3.xml
<?XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:fillViewport =真
机器人:focusableInTouchMode =真
机器人:可聚焦=真
机器人:滚动条=垂直
机器人:ID =@ ID /滚动视图> <的LinearLayout的android:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:方向=垂直
机器人:背景=#FFFFFF
机器人:layout_marginLeft =20dp
机器人:layout_marginRight =20dp
机器人:重力=左> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ title_chatparritos
机器人:TEXTSIZE =20dp
机器人:layout_marginTop =15dp
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Title/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ body_chatparritos
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =9dp
机器人:背景=@绘制/ blue_cornered_textview/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ link_khan
机器人:layout_marginTop = - 19dp
机器人:textAppearance =@风格/ TextAppearance.Design.Hint
机器人:TEXTSIZE =15dp
机器人:linksClickable =真
机器人:ID =@ + ID / linkAcademy
机器人:layout_gravity =CENTER_HORIZONTAL/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ title_xor
机器人:TEXTSIZE =20dp
机器人:layout_marginTop =25dp
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Title/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ body_xor
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =9dp
机器人:背景=@绘制/ blue_cornered_textview/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ instructions_xor
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =15dp
机器人:背景=@绘制/ yellow_cornered_textview
机器人:文字样式=大胆/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ title_rsa
机器人:TEXTSIZE =20dp
机器人:layout_marginTop =25dp
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Title/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ body_rsa
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =9dp
机器人:背景=@绘制/ blue_cornered_textview/>
<的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ link_rsa
机器人:layout_marginTop = - 19dp
机器人:textAppearance =@风格/ TextAppearance.Design.Hint
机器人:TEXTSIZE =15dp
机器人:linksClickable =真
机器人:ID =@ + ID / linkRSA
机器人:layout_gravity =CENTER_HORIZONTAL/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ instructions_rsa
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =15dp
机器人:背景=@绘制/ yellow_cornered_textview
机器人:文字样式=大胆/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ title_numeros
机器人:TEXTSIZE =20dp
机器人:layout_marginTop =25dp
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Title/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ body_numeros
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =9dp
机器人:背景=@绘制/ blue_cornered_textview/> <的TextView
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/诺塔
机器人:textAppearance =@风格/ TextAppearance.AppCompat.Body1
机器人:TEXTSIZE =15dp
机器人:layout_marginTop =30dp
机器人:layout_marginBottom =30dp
机器人:背景=@绘制/ red_cornered_textview/> < / LinearLayout中>
< /滚动型>
这是我TabFragment3.java
公共类TabFragment3扩展片段{
TextView的linkAcademy;
TextView的linkRsa;
@覆盖
公共查看onCreateView(LayoutInflater充气器,容器的ViewGroup,捆绑savedInstanceState){
查看查看= inflater.inflate(R.layout.tab_fragment_3,集装箱,FALSE);
linkAcademy =(TextView中)view.findViewById(R.id.linkAcademy);
linkAcademy.setMovementMethod(LinkMovementMethod.getInstance()); linkRsa =(TextView中)view.findViewById(R.id.linkRSA);
linkRsa.setMovementMethod(LinkMovementMethod.getInstance());
返回视图。
}
我的PagerAdapter.java
公共类PagerAdapter扩展FragmentStatePagerAdapter { INT mNumOfTabs; 公共PagerAdapter(FragmentManager FM,numOfTabs){
超(FM);
this.mNumOfTabs = numOfTabs;
} @覆盖
公共片段的getItem(INT位置){ 开关(位置){
情况下0:
TabFragment1 TAB1 =新TabFragment1();
返回TAB1;
情况1:
TabFragment2 TAB2 =新TabFragment2();
返回TAB2;
案例2:
TabFragment3 TAB3 =新TabFragment3();
返回TAB3;
默认:
返回null;
}
} @覆盖
公众诠释的getCount(){
返回mNumOfTabs;
}
我的MainActivity.java
公共类MainActivity扩展AppCompatActivity { @覆盖
保护无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.activity_main);
工具条工具栏=(栏)findViewById(R.id.toolbar);
setSupportActionBar(工具栏); TabLayout tabLayout =(TabLayout)findViewById(R.id.tab_layout);
tabLayout.addTab(tabLayout.newTab()的setText(XOR)。);
tabLayout.addTab(tabLayout.newTab()的setText(RSA));
tabLayout.addTab(tabLayout.newTab()的setText(R.string.tab_help));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); 最后ViewPager viewPager =(ViewPager)findViewById(R.id.pager);
最后PagerAdapter适配器=新PagerAdapter
(getSupportFragmentManager(),tabLayout.getTabCount());
viewPager.setAdapter(适配器);
viewPager.addOnPageChangeListener(新TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.setOnTabSelectedListener(新TabLayout.OnTabSelectedListener(){
@覆盖
公共无效onTabSelected(TabLayout.Tab标签){
viewPager.setCurrentItem(tab.getPosition());
} @覆盖
公共无效onTabUnselected(TabLayout.Tab标签){ } @覆盖
公共无效onTabReselected(TabLayout.Tab标签){ }
});
FloatingActionButton FAB =(FloatingActionButton)findViewById(R.id.fab);
fab.setOnClickListener(新View.OnClickListener(){
@覆盖
公共无效的onClick(查看视图){
Snackbar.make(查看,R.string.fab_info,Snackbar.LENGTH_LONG)
.setAction(动作,NULL).show();
}
});
主要的问题是在你的 main_activity.xml
。尝试复制这种布局,我从 chrisbanes项目了,让我们看看会发生什么:
<?XML版本=1.0编码=UTF-8&GT?;
< android.support.design.widget.CoordinatorLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:程序=http://schemas.android.com/apk/res-auto
机器人:ID =@ + ID / main_content
机器人:layout_width =match_parent
机器人:layout_height =match_parent> < android.support.design.widget.AppBarLayout
机器人:ID =@ + ID / appbar
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:主题=@风格/ ThemeOverlay.AppCompat.Dark.ActionBar> < android.support.v7.widget.Toolbar
机器人:ID =@ + ID /工具栏
机器人:layout_width =match_parent
机器人:layout_height =?ATTR / actionBarSize
机器人:ATTR / colorPrimary背景=
应用:popupTheme =@风格/ ThemeOverlay.AppCompat.Light
应用:layout_scrollFlags =滚动| enterAlways/> < 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 / viewpager
机器人: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_marginRight =24dp
机器人:layout_marginBottom =24dp
应用:fabSize =正常
应用:边框宽度=0dp
应用:海拔=6DP
机器人:SRC =@绘制/ ic_done/>< /android.support.design.widget.CoordinatorLayout>
在某些情况下,使用滚动型
在 CoordinatorLayout
可能会导致屏幕无法滚动。因此,使用 NestedScrollView
代替。
im a noob in android development and i was in a introduction course of Cryptography so i decide combine both and make this app. I use a TabLayout for making a tab for each cipher method (RSA and XOR), and one tab for Instructions and Help. Everything was working perfectly until i add a scrollView in the Help Tab with the instructions. The scrollView is not scrolling, and i don´t know why, i've been searching on web for help and doing every posible solution like change the width an height ScrollView properties, i'm stuck, can you help me please? Screenshots
-----EDIT 3/02/16-----
** My main_activity.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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.usuario.chatparritos.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
app:tabMode="fixed"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
tools:context="net.voidynullness.android.tabitytabs.TabLayoutActivity"
android:background="#ffffff"/>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_info"/>
</android.support.design.widget.CoordinatorLayout>
-----//EDIT 3/02/16-----
Here is my tab_fragment_3.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:focusableInTouchMode="true"
android:focusable="true"
android:scrollbars="vertical"
android:id="@id/scrollView">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#FFFFFF"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:gravity="left">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_chatparritos"
android:textSize="20dp"
android:layout_marginTop="15dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/body_chatparritos"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="9dp"
android:background="@drawable/blue_cornered_textview"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/link_khan"
android:layout_marginTop="-19dp"
android:textAppearance="@style/TextAppearance.Design.Hint"
android:textSize="15dp"
android:linksClickable="true"
android:id="@+id/linkAcademy"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_xor"
android:textSize="20dp"
android:layout_marginTop="25dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/body_xor"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="9dp"
android:background="@drawable/blue_cornered_textview"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/instructions_xor"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="15dp"
android:background="@drawable/yellow_cornered_textview"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_rsa"
android:textSize="20dp"
android:layout_marginTop="25dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/body_rsa"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="9dp"
android:background="@drawable/blue_cornered_textview"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/link_rsa"
android:layout_marginTop="-19dp"
android:textAppearance="@style/TextAppearance.Design.Hint"
android:textSize="15dp"
android:linksClickable="true"
android:id="@+id/linkRSA"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/instructions_rsa"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="15dp"
android:background="@drawable/yellow_cornered_textview"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_numeros"
android:textSize="20dp"
android:layout_marginTop="25dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/body_numeros"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="9dp"
android:background="@drawable/blue_cornered_textview"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/nota"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="15dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"
android:background="@drawable/red_cornered_textview"/>
</LinearLayout>
</ScrollView>
Here is my TabFragment3.java
public class TabFragment3 extends Fragment {
TextView linkAcademy;
TextView linkRsa;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.tab_fragment_3, container, false);
linkAcademy = (TextView) view.findViewById(R.id.linkAcademy);
linkAcademy.setMovementMethod(LinkMovementMethod.getInstance());
linkRsa = (TextView) view.findViewById(R.id.linkRSA);
linkRsa.setMovementMethod(LinkMovementMethod.getInstance());
return view;
}
My PagerAdapter.java
public class PagerAdapter extends FragmentStatePagerAdapter {
int mNumOfTabs;
public PagerAdapter(FragmentManager fm, int numOfTabs) {
super(fm);
this.mNumOfTabs = numOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
TabFragment1 tab1 = new TabFragment1();
return tab1;
case 1:
TabFragment2 tab2 = new TabFragment2();
return tab2;
case 2:
TabFragment3 tab3 = new TabFragment3();
return tab3;
default:
return null;
}
}
@Override
public int getCount() {
return mNumOfTabs;
}
And my MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
tabLayout.addTab(tabLayout.newTab().setText("XOR"));
tabLayout.addTab(tabLayout.newTab().setText("RSA"));
tabLayout.addTab(tabLayout.newTab().setText(R.string.tab_help));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
final PagerAdapter adapter = new PagerAdapter
(getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(adapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, R.string.fab_info, Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
The main problem is in your main_activity.xml
. Try to copy this layout that I got from chrisbanes' project and let's see what happens:
<?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"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways" />
<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/viewpager"
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_marginRight="24dp"
android:layout_marginBottom="24dp"
app:fabSize="normal"
app:borderWidth="0dp"
app:elevation="6dp"
android:src="@drawable/ic_done"/>
</android.support.design.widget.CoordinatorLayout>
In some cases, using ScrollView
within CoordinatorLayout
may cause the screen is unable to scroll. So use NestedScrollView
instead.
这篇关于滚动型里面加上TabLayout片段不滚动,为什么呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!