将ScrollView嵌套在TableRow中

索拉卜

我的意图是TextView通过将其嵌套在a中来使其可滚动ScrollView(尽管我知道TextView可以使其自身可滚动(不需要父级ScrollView),但我想以这种方式进行:))并ScrollView填充整个宽度屏幕。

以下代码中的布局有效,但是ScrollView不能填满屏幕的整个宽度。但是,其父级会TableRow填充整个宽度。

我试图代的值android:layout_widthScrollViewfill_parentmatch_parentwrap_content但它们都没有被完全填充的宽度。

<?xml version="1.0" encoding="utf-8"?>
<TableLayout 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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/activity_my">

    <TableRow>
        <EditText android:id="@+id/edit_message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="@string/edit_message"
            android:layout_weight="1"/>

        <Button
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="@string/button_send"
            android:onClick="sendMessage"/>
    </TableRow>

    <TableRow>
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scrollbars="vertical"
            android:fillViewport="true">
            <TextView
                android:id="@+id/message_box"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />
        </ScrollView>
    </TableRow>

</TableLayout>
索拉卜

我找到了解决方案!我加android:layout_weight="1"ScrollView

<ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:layout_weight="1"
        android:fillViewport="true">
        <TextView
            android:id="@+id/message_box"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
</ScrollView>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何修复嵌套在ScrollView中的BoxInsetLayout中的包装元素

来自分类Dev

将指令嵌套在表中

来自分类Dev

Java:如何将JPanel嵌套在GridLayout中?

来自分类Dev

将片段嵌套在片段中时遇到问题

来自分类Dev

将视图控制器嵌套在情节提要中

来自分类Dev

将反引号嵌套在git命令别名中

来自分类Dev

如何将表格行嵌套在表格列中?

来自分类Dev

聚合物:将内容嵌套在内容中

来自分类Dev

将IIF函数嵌套在MAX函数中

来自分类Dev

将IIF函数嵌套在MAX函数中

来自分类Dev

可以将命令替换嵌套在变量替换中吗?

来自分类Dev

将一个ListView嵌套在GridView中

来自分类Dev

如何将表格行嵌套在表格列中?

来自分类Dev

查找“损坏的”文件,将if嵌套在find命令中

来自分类Dev

使用CSS将图像嵌套在导航栏中

来自分类Dev

将AnyObject转换为嵌套在数组中的Dictionary

来自分类Dev

将 div 放在嵌套在 flex 行下的列中

来自分类Dev

将<button>嵌套在<a>内

来自分类Dev

Django嵌套在模板中

来自分类Dev

嵌套在ActionListener中的ActionListener?

来自分类Dev

嵌套在r中的循环

来自分类Dev

PredicateBuilder:OR 条件嵌套在 .And() 中

来自分类Dev

嵌套在 elasticsearch 中的嵌套聚合中

来自分类Dev

rxjs forkJoin将嵌套的Observable嵌套在另一个Observable中

来自分类Dev

将Python字典对象转换为JSON,但将JSON嵌套在父数组中

来自分类Dev

正确的方法将指令嵌套在角

来自分类Dev

将defaultdict嵌套在任意深度

来自分类Dev

如何将渐变添加到嵌套在CollapsingToolbar中的ImageView中

来自分类Dev

当可能存在#Value时,将IF函数嵌套在Excel中!目标单元中的错误

Related 相关文章

热门标签

归档