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

如何 我想实现,字体下面的半透明背景, 不会遮住图片。 请问怎么处理呢?
我已经设置了如下的值( 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

いいねを押す +0
刘奇

<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>

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!