首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在Android中动态替换按钮?

如何在Android中动态替换按钮?
EN

Stack Overflow用户
提问于 2018-07-25 06:16:36
回答 1查看 197关注 0票数 -1

我在做一个待办事项应用。基本上,我希望屏幕开始时只有一个顶部的添加按钮。当用户单击按钮时,按钮向下滑动,用户可以输入仅适合一行/两行的字符。用户一次只能输入10-15个这样的任务,每次按钮向下滑动相同的距离。我该怎么做呢?下面是我编写的当前xml代码:

<ListView
    android:id="@+id/list_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginTop="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView"
    app:layout_constraintVertical_bias="0.111" />

<Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:text="Button"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/list_view" />

另外,我知道listview属性可能是关闭的。我会尝试通过谷歌搜索来修复它们,但如果您现在就能帮助我,我将不胜感激。把这当作一个额外的问题吧。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51508299

复制
相关文章

相似问题

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