如何创建自定义 TextView 背景 Android? [英] How to create a custom TextView Background Android?

查看:19
本文介绍了如何创建自定义 TextView 背景 Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的 TextView 创建一个背景,使其看起来完全像这个(黄色框).

I want to create a background for my TextView to look exactly like this one(Yellow Box).

创建图像后,如何设置电视的背景?

After I create the image how do I go about setting the background to the TV?

谢谢!

推荐答案

或者你可以创建一个可绘制的形状.

Or you could create a shape drawable.

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid android:color="@color/Yellow" />
<stroke android:width="@dimen/" android:color="@color/"/> 
<corners android:radius="@dimen/"/>
<gradient
    android:startColor="@color/"
    android:centerColor="@color/"
    android:endColor="@color/"
    android:centerX="0.5"
    android:centerY="0.5"
    android:gradientRadius="100"
    android:type="linear" />
</shape>

这篇关于如何创建自定义 TextView 背景 Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆