Android 在其他视图的滚动条上的片段中隐藏视图
我使用的是目录中的导航抽屉活动,有一个线性布局,它将用碎片膨胀 content\u main.xmlAndroid 在其他视图的滚动条上的片段中隐藏视图,android,android-layout,android-fragments,Android,Android Layout,Android Fragments,我使用的是目录中的导航抽屉活动,有一个线性布局,它将用碎片膨胀 content\u main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools=
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:id="@+id/content_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="net.techdesire.khabargujarat.HomeActivity"
tools:showIn="@layout/app_bar_home">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment_container"/>
</RelativeLayout>
<android.support.percent.PercentRelativeLayout
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"
tools:context="fragment.HomeFragment">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
app:layout_heightPercent="40%"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
app:layout_heightPercent="60%"
android:layout_below="@+id/viewpager">
<TextView
android:id="@+id/about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/about_khijadiya"
android:textAppearance="@style/TextAppearance.AppCompat.Large"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/about"
android:text="@string/dummy"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
</RelativeLayout>
</android.support.percent.PercentRelativeLayout>
fragment_home.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:id="@+id/content_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="net.techdesire.khabargujarat.HomeActivity"
tools:showIn="@layout/app_bar_home">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment_container"/>
</RelativeLayout>
<android.support.percent.PercentRelativeLayout
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"
tools:context="fragment.HomeFragment">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
app:layout_heightPercent="40%"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
app:layout_heightPercent="60%"
android:layout_below="@+id/viewpager">
<TextView
android:id="@+id/about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/about_khijadiya"
android:textAppearance="@style/TextAppearance.AppCompat.Large"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/about"
android:text="@string/dummy"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
</RelativeLayout>
</android.support.percent.PercentRelativeLayout>
我认为,您的要求是在滚动时折叠视图
所以你可以用
“安卓.支持.设计.小部件.折叠工具栏布局”
它是在材料设计中实现的
您可以参考此链接:
我不明白你想要什么。你能试着用另一种方式来解释吗?是的,是这样的,但不完全是这样。我不想做任何事情。我可以只在一个xml文件中进行更改吗?可以,但这取决于您的视角。