如何解决在 Android 应用程序中,如何使用透明文本制作线性视图,以便父视图可见?
关于如何使包含一些文本的视图透明以使其与另一个视图重叠的任何想法?
Here's an example image of what im referring to
我正在尝试创建一个功能,以便像 Whatsapp Messenger 一样在聊天页面中显示用户的个人简介。
解决方法
使用下一个代码
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#fff"
android:text="Your text "
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:textAlignment="center"
android:background="#60000000"
/>
您可以在您使用的任何视图中添加上述 XML,例如下一个视图
<FrameLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:background="#343"
android:layout_height="match_parent">
<!-- more views here -->
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#fff"
android:text="Your text "
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:textAlignment="center"
android:background="#60000000"
/>
</FrameLayout>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。