草庐IT

android - ScrollView 未在滑动抽屉内滚动

coder 2023-12-14 原文

我有一个 framelayout 布局,里面有 2 个 subview ,滑动抽屉和 ListView 。在滑动抽屉内我需要一个 ScrollView 但是当我运行它时 ScrollView 无法滚动。以前有人遇到过同样的问题吗?

这是我的布局,当我把scrollview里面的linearlayout删掉后就可以正常运行了。 谁能帮忙?

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<ListView
    android:id="@+id/myListView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</ListView>

<SlidingDrawer
    android:id="@+id/slidedrawer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:allowSingleTap="false"
    android:content="@+id/konten"
    android:handle="@+id/slider_handle" >

    <LinearLayout
        android:id="@+id/slider_handle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/slider_song"
        android:paddingLeft="40dip"
        android:paddingTop="10dip"
        android:scaleType="centerCrop" >

        <TextView
            android:id="@+id/song_title_animation"
            style="@style/CodeFont"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit="marquee_forever"
            android:scrollHorizontally="true"
            android:singleLine="true"
            android:text="No song played" />
    </LinearLayout>
    <!-- <include -->
    <!-- android:id="@+id/konten" -->
    <!-- layout="@layout/playback" /> -->

    <LinearLayout
        android:id="@+id/konten"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/album_art"
            android:layout_width="match_parent"
            android:layout_height="250dip"
            android:background="@drawable/albumart"
            android:gravity="bottom"
            android:orientation="vertical" >


            <SeekBar
                android:id="@+id/seekbar_lagu"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:max="20"
                android:progress="0"
                android:progressDrawable="@drawable/seekbar_progress"
                android:secondaryProgress="0"
                android:thumb="@drawable/seek_thumb" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="0dip"
                android:background="@drawable/play_background"
                android:gravity="center_horizontal"
                android:paddingTop="5dip" >

                <Button
                    android:layout_width="50dip"
                    android:layout_height="50dip"
                    android:id="@+id/button_backward"
                    android:background="@drawable/button_backward" />

                <Button
                    android:layout_width="50dip"
                    android:layout_height="50dip"
                    android:id="@+id/button_stop"
                    android:background="@drawable/button_stop" />

                <Button
                    android:layout_width="50dip"
                    android:layout_height="50dip"
                    android:id="@+id/button_play"
                    android:background="@drawable/button_play" />

                <Button
                    android:layout_width="50dip"
                    android:layout_height="50dip"
                    android:id="@+id/button_forward"
                    android:background="@drawable/button_forward" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/title_background" >

            <TextView
                android:id="@+id/song_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="song title" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/title_background" >

            <TextView
                android:id="@+id/song_artist"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="song artist" />
        </LinearLayout>
    </LinearLayout>
</SlidingDrawer>

</FrameLayout>

最佳答案

将 scrollView 保持在 slidedrawer 中,并将所有内容保持在一个线性布局中。 如下图

<SlidingDrawer
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:handle="@+id/handle"
    android:content="@+id/content">

    <Button
        android:id="@id/handle"
        android:layout_width="88dip"
        android:layout_height="44dip"
        android:background="@drawable/btn_blue"
        android:text="help"
        android:textColor="#ffffff"/>

    <ScrollView
        android:id="@id/content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <LinearLayout
            android:orientation="vertical"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent">

        </LinearLayout>

    </ScrollView>

</SlidingDrawer>

关于android - ScrollView 未在滑动抽屉内滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8815972/

有关android - ScrollView 未在滑动抽屉内滚动的更多相关文章

  1. ruby-on-rails - 未在 Ruby 中初始化的对象 - 2

    我在Rails工作并有以下类(class):classPlayer当我运行时bundleexecrailsconsole然后尝试:a=Player.new("me",5.0,"UCLA")我回来了:=>#我不知道为什么Player对象不会在这里初始化。关于可能导致此问题的操作/解释的任何建议?谢谢,马里奥格 最佳答案 havenoideawhythePlayerobjectwouldn'tbeinitializedhere它没有初始化很简单,因为你还没有初始化它!您已经覆盖了ActiveRecord::Base初始化方法,但您没有调

  2. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  3. ruby-on-rails - 在条件路由期间未在 Rails 3 中设置 request.subdomain - 2

    我正在尝试根据RyanBatesscreencastonsubdomains在Rails3中设置子域.但是它对我不起作用。我有以下设置:#routes.rbconstraints(Subdomain)doget'devices'=>'devices#all'end#lib/subdomain.rbclassSubdomaindefself.matches?(request)#binding.pryrequest.subdomain.present?&&request.subdomain=="admin"endend加载urladmin.localhost:3000/devices应该将

  4. ruby - 绕过 Element 的方法无法滚动到 View 中 - Watir-webdriver with Ruby - 2

    因此,我们的页面中有以下代码:OnOff这是2个单选按钮。'开和关'。“关闭”是默认值。使用Watir-webdriver和Ruby,我们想要选择“打开”单选按钮。我们这样做:browser.radio(:id=>"HasRegistration_true").set但在这样做时,我们得到以下错误:`WebElement.clickElement':Elementcannotbescrolledintoview:[objectHTMLInputElement](Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)我们知道Sele

  5. ruby-on-rails - 遏制 gem 未在 linux redhat 中安装 - 2

    我正在使用ruby​​-1.9.2-p290并安装了curl、curl-devel、libcurl和libcurl-devel但curbgem没有安装,我收到以下错误:Gem::Installer::ExtensionBuildError:ERROR:Failedtobuildgemnativeextension./home/jophine/.rvm/rubies/ruby-1.9.2-p290/bin/rubyextconf.rbcheckingforcurl-config...yescheckingforcurlinfo_redirect_time...nocheckingforc

  6. Android Studio开发之使用内容组件Content获取通讯信息讲解及实战(附源码 包括添加手机联系人和发短信) - 2

    运行有问题或需要源码请点赞关注收藏后评论区留言一、利用ContentResolver读写联系人在实际开发中,普通App很少会开放数据接口给其他应用访问。内容组件能够派上用场的情况往往是App想要访问系统应用的通讯数据,比如查看联系人,短信,通话记录等等,以及对这些通讯数据及逆行增删改查。首先要给AndroidMaifest.xml中添加响应的权限配置 下面是往手机通讯录添加联系人信息的例子效果如下分成三个步骤先查出联系人的基本信息,然后查询联系人号码,再查询联系人邮箱代码 ContactAddActivity类packagecom.example.chapter07;importandroid

  7. Android 10.0 设置默认launcher后安装另外launcher后默认Launcher失效的功能修复 - 2

    1.前言 在10.0的系统rom定制化开发中,在系统中有多个launcher的时候,会在开机进入launcher的时候弹窗launcher列表,让用户选择进入哪个launcher,这样显得特别的不方便所以产品开发中,要求用RoleManager的相关api来设置默认Launcher,但是在设置完默认Launcher以后,在安装一款Launcher的时候,默认Launcher就会失效,在系统设置的默认应用中Launcher选项就为空,点击home键的时候会弹出默认Launcher列表,让选择进入哪个默认Launcher.所以需要从安装Launcher的流程来分析相关的设置。来解决问题设置默认La

  8. AiBote 2022 新研发的自动化框架,支持 Android 和 Windows 系统。速度非常快 - 2

    Ai-Bot基于流行的Node.js和JavaScript语言的一款新自动化框架,支持Windows和Android自动化。1、Windowsxpath元素定位算法支持支持Windows应用、.NET、WPF、Qt、Java和Electron客户端程序和ie、edgechrome浏览器2、Android支持原生APP和H5界面,元素定位速度是appium十倍,无线远程自动化操作多台安卓设备3、基于opencv图色算法,支持找图和多点找色,1080*2340全分辨率找图50MS以内4、内置免费OCR人工智能技术,无限制获取图片文字和找字功能。5、框架协议开源,除官方node.jsSDK外,用户可

  9. Android Gradle 7.1+新版本依赖变化 - 2

    前一段时间由于工作需要把可爱的小雪狐舍弃了,找到了小蜜蜂。但是新版本的小蜜蜂出现了很多和旧版本不一样的位置。1.功能位置迁移,原来在工程build.gradle的buildscript和allprojects移动至setting.gradle并改名为pluginManagement和dependencyResolutionManagement。里面的东西依旧可以按照原来的copy过来。pluginManagement{repositories{gradlePluginPortal()google()mavenCentral()}}dependencyResolutionManagement{r

  10. ruby - Ruboto 的最佳教程(适用于 Android 的 ruby​​)? - 2

    关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于StackOverflow来说是偏离主题的,因为它们往往会吸引自以为是的答案和垃圾邮件。相反,describetheproblem以及迄今为止为解决该问题所做的工作。关闭9年前。Improvethisquestion我几乎用完了Ruby,但现在想试试Ruboto,android上的ruby​​。谷歌未能给我足够的(几乎没有结果)。所以任何人都可以分享一些关于Ruboto的教程。

随机推荐