Tôi đã đạt được việc xóa layout_scrollFlags
trong số CollapsingToolbarLayout
của mình. nhưng tôi cần phải xóa số layout_behavior
trong số NestedScrollView
của mình để khi không có nội dung nào trên chế độ xem cuộn lồng nhau, việc thu gọn thanh công cụ cũng sẽ bị tắt. Loại bỏ layout_behavior của NestedScrollView của tôi là rất dễ dàng, chỉ cần tôi loại bỏ các dòng mã trong xml của bạn theo nghĩa đen nhưng làm thế nào tôi có thể loại bỏ nó programatically?Làm thế nào để loại bỏ lập trình một hành vi bố trí của NestedScrollView của tôi?
xml của tôi:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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:fitsSystemWindows="true"
android:background="@android:color/white">
<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">
<fragment
android:id="@+id/pawfile_header"
android:name="com.lightbulb.pawesome.fragments.PawfileHeaderFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<fragment
android:id="@+id/pawfile_timeline"
android:name="com.lightbulb.pawesome.user_timeline.PawesomeUserTimelineFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Bạn có thể sử dụng tính năng Hiển thị bố cục GONE. –
Tôi xin lỗi nhưng thanh công cụ collpasing có một đứa trẻ. vì vậy nếu tôi định đặt chế độ hiển thị của mình, chế độ xem bên trong thanh công cụ collpasing sẽ biến mất quá –
@android_softy vui lòng xem câu hỏi cập nhật của tôi –