gpt4 book ai didi

android - 抽屉导航中的 ScrollView

转载 作者:行者123 更新时间:2023-11-30 02:19:25 26 4
gpt4 key购买 nike

我设计了自己的自定义抽屉导航,它看起来像这样:
enter image description here

这个抽屉导航的 xml 代码是:

<RelativeLayout
android:id="@+id/UserOptionsDrawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/nav_drawer_background_black"
tools:layout="@layout/fragment_navigation_drawer">

<!-- Cover or Banner -->

<RelativeLayout
android:id="@+id/rlBanner"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="vertical">

<!-- Cover Pic Container -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp">

<!-- Cover Picture -->
<ImageView
android:id="@+id/ivCoverPic"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="centerCrop"
android:src="@drawable/cover_pic"/>

<!-- Tint -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="150dp"
android:id="@+id/llCoverTint">
</LinearLayout>
</RelativeLayout>

<!-- Profile Pic Container -->
<LinearLayout
android:id="@+id/llProfilePicContainer"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="7dp"
android:orientation="vertical">

<com.example.neotavraham.MLRoundedImageView
android:id="@+id/civProfilePic"
android:src="@drawable/ic_no_user"
android:layout_height="65dp"
android:layout_width="65dp"
/>

</LinearLayout>

<TextView
android:id="@+id/tvUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/llProfilePicContainer"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/llProfilePicContainer"
android:textColor="#ffffff"
android:textSize="15sp"
android:text="Username"/>

<TextView
android:id="@+id/tvUserEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvUserName"
android:layout_below="@+id/tvUserName"
android:textColor="#ffffff"
android:textSize="12sp"
android:text="example@hostname.com"/>

</RelativeLayout>

<TextView
android:id="@+id/tvShabatCategory"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_below="@id/rlBanner"
android:text="עדכון זמני שבת"
android:textSize="15dp"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceSmall"/>

<!-- ListMenu -->

<ListView
android:id="@+id/navigation_menu_container"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_below="@id/tvShabatCategory"
android:layout_gravity="start"
android:background="@android:color/transparent"
android:choiceMode="singleChoice"
android:divider="@color/divider_orange"
android:dividerHeight="2dp" >
</ListView>

<TextView
android:id="@+id/tvWeeklyCategory"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_below="@id/navigation_menu_container"
android:text="עדכון זמני השבוע"
android:textSize="15dp"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceSmall"/>

<ListView
android:id="@+id/lv_weekly_updates"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_below="@id/tvWeeklyCategory"
android:layout_gravity="start"
android:background="@android:color/transparent"
android:choiceMode="singleChoice"
android:divider="@color/divider_orange"
android:dividerHeight="2dp" >
</ListView>

<TextView
android:id="@+id/tvMessagesCategory"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_below="@id/lv_weekly_updates"
android:text="עדכון הודעות"
android:textSize="15dp"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceSmall"/>

<ListView
android:id="@+id/lv_messages_updates"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_below="@id/tvMessagesCategory"
android:layout_gravity="start"
android:background="@android:color/transparent"
android:choiceMode="singleChoice"
android:divider="@color/divider_orange"
android:dividerHeight="2dp" >
</ListView>

<TextView
android:id="@+id/tvEvenetsCategory"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_below="@id/lv_messages_updates"
android:text="עדכון הודעות"
android:textSize="15dp"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceSmall"/>

<ListView
android:id="@+id/lv_events_updates"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_below="@id/tvEvenetsCategory"
android:layout_gravity="start"
android:background="@android:color/transparent"
android:choiceMode="singleChoice"
android:divider="@color/divider_orange"
android:dividerHeight="2dp" >
</ListView>

<TextView
android:id="@+id/tvOptionsCategory"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_below="@id/lv_events_updates"
android:text="אפשרויות נוספות"
android:textSize="15dp"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceSmall"/>

<ListView
android:id="@+id/lvOptions"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_below="@id/tvOptionsCategory"
android:layout_gravity="start"
android:background="@android:color/transparent"
android:choiceMode="singleChoice"
android:divider="@color/divider_orange"
android:headerDividersEnabled="true"
android:dividerHeight="2dp" >
</ListView>

</RelativeLayout>

{它只是带有 android.support.v4.widget.DrawerLayout 的整个 xml 文件的一部分|标签..}

无论如何,底部还有更多我无法触及的按钮,因为它不是 ScrollView ......

我试图用 ScrollView 包装它,但结果是一团糟..

我能做些什么?

编辑:

这就是我使用带有线性布局的 ScrollView 时发生的事情:
enter image description here

这是代码:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rlBanner">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

...everything is the same inside

</LinearLayout>
</ScrollView>

最佳答案

好的,所以问题是您在 ScrollView 中有一个 ListView 。您有两个主要选项来处理此问题:

  • 仍然使用 ScrollView 中的 ListView 并解决滚动问题(因为两种布局都有滚动),如下所示:

  • Android list view inside a scroll view
  • 用自定义线性布局替换 ListView ,并将其添加到您的 ScrollView 中。还有一些链接建议使用此选项,因为您将不再有两个可以滚动的 View :

  • How can I put a ListView into a ScrollView without it collapsing?

    Android: Listview inside ScrollView

    这是第二点的实际教程:

    http://www.androidhub4you.com/2014/03/android-listview-into-scrollview-issue.html

    希望这可以帮助! :)

    关于android - 抽屉导航中的 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28814144/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com