如何绘制边框的TextView使用$ C $ Android中创建的C不是XML [英] How to draw borders for TextView created using Code not by XML in Android

查看:175
本文介绍了如何绘制边框的TextView使用$ C $ Android中创建的C不是XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过code,而不是XML创建TextView的我。我想提请各地TextView.How我们可以做到这一点使用code,而不是XML边界?我也想,当我尝试的setText的是一些2线则是TextView的向下移动的TextView的?也PLZ指导我解决这个问题。
我将waititng答复。结果
Regarda,

I created my TextView through code rather than XML. I want to draw a border around the TextView.How can we do this using code rather than XML? I also wanted when I try to setText for the TextView which is of some 2 lines then TextView is moving downward? plz also guide me to solve this problem. I will be waititng for reply .
Regarda,

推荐答案

大概是最容易得到一个不错的边框以文本视图是创建一个9片图像并将其设置为背景的文本字段的方法。只是让你的图象填补权利,你有一个边框为您的文本视图

Probably the easiest way to get a nice border to your text view would be to create a 9-patch image and set it as background to your text field. Just get padding right in your image and you have a border for your text view

我真的不明白你的第二个问题。将设置你的文本字段为单行帮助?
链接TextView的API

I don't really understand your second question. Would setting your text field as a single line help? link to TextView API

这篇关于如何绘制边框的TextView使用$ C $ Android中创建的C不是XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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