android - TextView 如何设置半透明背景色?如图的效果。
伊谢尔伦
伊谢尔伦 2017-04-17 14:34:43
0
2
571

如何 我想实现,字体下面的半透明背景, 不会遮住图片。 请问怎么处理呢?
我已经设置了如下的值( android:background="#e0000000"),但实现的效果, 确实黑色的背景,遮住了图片。

<TextView
        android:id="@+id/itemName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/app_name"
        android:textColor="@color/defaultWhite"
        android:textSize="16sp"
        android:background="#e0000000"
        android:layout_gravity="bottom" />
        
        
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

모든 응답(2)
Ty80
android:alpha="0.5"

参考 View.html#attr_android:alpha

alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque).
Related Methods: setAlpha(float)

请善用developer.android.com

刘奇

<TextView
...
background="#99000000"
style="@style/Transparent"
...
</TextView>

<style name="Transparent" parent="AppTheme">

    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@null</item>
    <item name="android:windowNoTitle">true</item>

</style>

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!