gpt4 book ai didi

java - TextSwitcher 重力底部中的 TextView 无法工作

转载 作者:行者123 更新时间:2023-11-30 05:04:02 24 4
gpt4 key购买 nike

我有一个标准的 TextViewTextSwitcher:

TextView :

<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:textColor="#3F51B5"
android:textSize="40sp"
android:gravity="bottom|center_horizontal"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:background="@android:color/black">

文本切换器:

<TextSwitcher
android:id="@+id/questionTextSwitcher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"/>

TextView 的文本是动态变化的,有时文本是几行。

黑色背景是TextView,白色是TextSwitcher:

当设置较长的文本时,它看起来像这样: enter image description here

当文本较小时,它看起来像这样: enter image description here

我希望将 TextView 放置在 TextSwitcherbottom - 但那没有发生?

最佳答案

尝试匹配父级高度并使用 layout_gravity 属性。

关于java - TextSwitcher 重力底部中的 TextView 无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54878725/

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