我正在进行布局,以便将包含回收站视图的片段的ViewPager放置在协调器布局的nester scrollView中。
问题是,一旦我点击了回收站视图,嵌套的滚动视图就无法运行..
是否有任何可能的方法来使这些布局也滚动
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/lin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<NestedScrollView>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="190dp"
android:minHeight="190dp"
app:layout_collapseMode="parallax" >
<ViewFlipper
android:id="@+id/view_flipper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"/>-->
</ViewFlipper>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
答案 0 :(得分:0)
不要同时使用「Recycler view View Pager + NestedScrollView + CoordinatorLayout」,只需删除NestedScrollView即可。
<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/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:expandedTitleTextAppearance="@android:color/transparent"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<LinearLayout
android:id="@+id/header_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:layout_collapseParallaxMultiplier="0.7">
<..somethings..>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="48dp"
android:visibility="invisible"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_gravity="bottom"
android:orientation="vertical">
<View
android:layout_width="wrap_content"
android:layout_height="0.4dp"
android:background="?attr/separate_line_color"/>
<android.support.design.widget.TabLayout
android:id="@+id/tablayout_user"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view_line"
app:layout_scrollFlags="enterAlways"
app:tabGravity="center"
android:background="?attr/common_bg_white_black"
app:tabIndicatorColor="@color/theme_color"
app:tabIndicatorHeight="2dp"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabPaddingEnd="20dp"
app:tabPaddingStart="20dp"
app:tabSelectedTextColor="@color/theme_color"
app:tabTextAppearance="@style/TabTextAppearance2"
app:tabTextColor="?attr/text_color_2"/>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
答案 1 :(得分:-3)
ViewPager无法在NestedScrollView中使用。您必须将其用作CoordinatorLayout的子项。
TradeManager tm = new TradeManager(Bot.ApiKey, Bot.SteamWeb);
Trade t = tm.CreateTrade(Bot.SteamUser.SteamID, steamId);
TradeOffer offer = Bot.NewTradeOffer(steamId);
GenericInventory GI = new GenericInventory(Bot.SteamWeb);
List<long> contextId = new List<long>();
contextId.Add(2);
GI.load(730, contextId, steamId);
foreach (GenericInventory.Item item in GI.items.Values)
{
GenericInventory.ItemDescription ID = GI.getDescription(item.assetid);
//SendChatMessage("App ID: " + item.appid + " ContextID: " +
// item.contextid + " Asset ID: " + item.assetid);
SendChatMessage(ID.name + "|" + ID.ToString());
}