【发布时间】:2016-06-27 11:58:18
【问题描述】:
我尝试在滚动视图中创建带有滚动视图的布局 Whatssupp 的工作原理 这是我的布局的样子
当我向上滚动时,“第一部分”应该消失,“第二部分”及其 lisview 应该占据第一位置,但主题应该保持在屏幕顶部。非常熟悉 Whatssupp。我发现的例子并不能解决我的问题。希望能得到任何帮助。谢谢。
这是我的 xml 代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Main Container -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Following Followers Part 1 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/btn_leftside_layout_2_followers"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="554 Followers" />
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:src="@drawable/person_icon" />
<Button
android:id="@+id/btn_leftside_layout_2_following"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="654 Following" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:text="@string/txt_frag_followers_following"
android:textSize="35dp" />
<!--TOPICS Part 2 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:background="@color/grey_200"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some Button" />
<ListView
android:id="@+id/lv_leftside_layout_2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
【问题讨论】:
标签: xml android-layout android-studio layout