TextView和Button之间的实际差异 [英] Actual difference between TextView and Button

查看:277
本文介绍了TextView和Button之间的实际差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到按钮的主要目的是对单击事件做出反应,并且ButtonTextView都具有文本,可绘制(图标)和click事件的属性,它们之间的实际区别是什么,何时应选择一个?

Considering the main purpose of a button is to react to a click event, and the fact that both Button and TextView has properties for text, drawable (icon) and click event, what is the actual difference between them, when should you chose one over the other?

推荐答案

查看参考文档,按钮类扩展了 TextView 类.在此按钮可以添加一些样式上的更改(例如,默认背景图片,附加填充),以便更快地适应您的设计.

Looking at the reference docs, the Button class extends the TextView class. From there, the Button adds a few stylistic changes (e.g., default background image, additional padding) to allow quicker adaptation to your designs.

IMO,您选择使用的应该取决于您要如何设计应用程序.如果您使用默认主题并进行最少的样式更改,则Button可以更快地可视化;另一方面,如果您要进行很多自定义,则TextView可以使您轻松得多.

IMO, the one you choose to use should depend on how you want to design your app. If you use the default theme with minimal stylistic changes, Buttons can be quicker to visualize; on the other hand, if you are doing a lot of customization, TextView will let you do that much easier.

****

** ** GrepCode shows that from a functionality point of view, there is no difference aside from class name.

这篇关于TextView和Button之间的实际差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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