Android AppBar长于屏幕宽度
我正在尝试创建一个用户配置文件布局,它有一个标准的协调器布局,用一个折叠的工具栏嵌套一个应用程序栏。折叠工具栏包含一个标题,其中包含背景英雄图像、个人资料图像和他的详细信息。之后是一个线性布局,包含他的用户追随者信息,然后是用户兴趣,然后是最近的位置,然后是一个水平滚动的相册,然后是一个选项卡布局(使我的AppBar成为一个长的) 在应用程序栏外,我有一个查看寻呼机 滚动时,我希望工具栏固定,选项卡粘住Android AppBar长于屏幕宽度,android,android-coordinatorlayout,android-collapsingtoolbarlayout,androiddesignsupport,android-appbarlayout,Android,Android Coordinatorlayout,Android Collapsingtoolbarlayout,Androiddesignsupport,Android Appbarlayout,我正在尝试创建一个用户配置文件布局,它有一个标准的协调器布局,用一个折叠的工具栏嵌套一个应用程序栏。折叠工具栏包含一个标题,其中包含背景英雄图像、个人资料图像和他的详细信息。之后是一个线性布局,包含他的用户追随者信息,然后是用户兴趣,然后是最近的位置,然后是一个水平滚动的相册,然后是一个选项卡布局(使我的AppBar成为一个长的) 在应用程序栏外,我有一个查看寻呼机 滚动时,我希望工具栏固定,选项卡粘住 ///用户的追随者和追随者 //关于用户内容 //用户的利益 //用户访问的最近地点 /
///用户的追随者和追随者
//关于用户内容
//用户的利益
//用户访问的最近地点
//用户照片的水平滚动
这在大屏幕手机上运行良好,但在小屏幕上,appbar布局的高度大于屏幕高度,因此被截断
如果是单个列表,我可以将额外的标题放入回收器视图,但我使用的是ViewPager
我尝试在appbar之后将这个额外的标题内容放入带有viewpager的嵌套滚动中,但后来我的viewpager没有出现。由于绝望,我甚至试着玩两个AppBar,但也没有成功
任何基于不在代码中自定义布局行为的解决方案都是首选。提前感谢我会尽快更新屏幕截图,但你为什么认为滚动标志是个问题?AppBar允许在自己的内容上滚动吗?很难说,但是,让我们看看屏幕截图,然后我会检查它。这很奇怪,因为你说它在大屏幕上工作。
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/userprofileAppbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/profile_background_color"
android:fitsSystemWindows="true"
android:visibility="visible">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/header_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_layout"
android:fitsSystemWindows="true"
app:contentScrim="@color/gradient_bottom"
app:expandedTitleMarginBottom="25dp"
app:expandedTitleMarginStart="22dp"
app:layout_scrollFlags="scroll|snap"
app:statusBarScrim="@color/gradient_bottom">
<LinearLayout
android:id="@+id/user_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:background="@color/user_background_color"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<com.example.local.ui.RoundedImage
android:id="@+id/user_profile_pic"
android:layout_width="78.7dp"
android:layout_height="78.7dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:clickable="false"
android:src="@drawable/ic_avatar" />
<com.example.local.buddycloud.customviews.TypefacedTextView
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="13.7dp"
android:layout_weight="1"
android:text="Monika Singh"
android:textColor="@color/white"
android:textSize="16sp" />
<com.example.local.buddycloud.customviews.TypefacedTextView
android:id="@+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:text="Lives in Sushant Lok 1"
android:textColor="@color/white"
android:textSize="12sp" />
<com.example.local.buddycloud.customviews.TypefacedTextView
android:id="@+id/user_follow_button"
style="?attr/borderlessButtonStyle"
android:layout_width="110dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="20.7dp"
android:layout_weight="1"
android:background="@drawable/rounded_corners_follow_button"
android:clickable="true"
android:lines="1"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:text="+ FOLLOW"
android:textColor="@color/white"
android:textSize="13sp"
app:fontType="@string/font_regular" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
</android.support.design.widget.CollapsingToolbarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_collapseMode="none"
app:layout_scrollFlags="scroll|snap">
<LinearLayout
android:id="@+id/followers_following_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal"
android:paddingBottom="14.7dp"
android:paddingTop="14dp">
/// Followers and Following for the user
</LinearLayout>
<View
android:id="@+id/below_followers_following_bar"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider" />
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/about_user_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="13.3dp"
android:background="@color/white"
android:visibility="visible"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="0dp">
// About user content
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/user_interests_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8.3dp"
android:background="@color/white"
android:visibility="gone"
card_view:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="17.3dp"
android:orientation="vertical">
// Interests of the user
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/user_recent_places_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8.3dp"
android:background="@color/white"
android:visibility="gone"
card_view:cardCornerRadius="4dp">
// Recent places visted by user
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/user_photos_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8.3dp"
android:background="@color/white"
android:visibility="visible"
card_view:cardCornerRadius="4dp">
// Horizontal scroll of user photos
</android.support.v7.widget.CardView>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/user_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="17dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="17dp"
android:background="@color/white"
app:tabGravity="fill"
app:tabIndicatorColor="@color/light_blue_color"
app:tabIndicatorHeight="3.3dp"
app:tabMode="fixed" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/user_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>