首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ScrollView -如何在ScrollView中启用水平滚动

ScrollView -如何在ScrollView中启用水平滚动
EN

Stack Overflow用户
提问于 2020-04-21 13:47:24
回答 2查看 50关注 0票数 0

所以我有一个里面有TextViewScrollView。当文本的String长于屏幕宽度时,它只是在下一行中移动。我想通过在ScrollView中添加HorizontalScrolling来避免新的内联。另外,我想让文本可选,这样用户就可以复制文本。有可能吗?

代码语言:javascript
运行
复制
        <ScrollView
            android:id="@+id/scroll_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">

                <TextView
                    android:id="@+id/text_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="15dp"
                    android:layout_marginEnd="15dp"
                    android:layout_marginBottom="15dp"
                    android:ellipsize="end"
                    android:textIsSelectable="true"
                    android:justificationMode="inter_word"
                    android:lineSpacingExtra="5dp"
                    android:textSize="15sp"
                    tools:targetApi="o" />
        </ScrollView>
EN

Stack Overflow用户

回答已采纳

发布于 2020-04-21 14:49:53

代码语言:javascript
运行
复制
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:scrollbars="vertical">

    <HorizontalScrollView 
        android:layout_width="match_parent" android:layout_height="wrap_content">

        <FrameLayout android:layout_width="320dp"
            android:layout_height="match_parent" 
            android:background="#000000"/>

    </HorizontalScrollView>

</ScrollView>
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61336734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档