如何将按钮文本时的状态是pressed [英] How to move buttons text when state is pressed

查看:169
本文介绍了如何将按钮文本时的状态是pressed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个自定义背景的按钮,也为不同的按钮状态。但现在我要,我无法理解一个点进行。

I made a custom background for a button and also for different button states. But now I made to a point that I cannot understand.

当按钮处于正常状态,那么它看起来就好了。但是,当我preSS的按钮,我需要将文本向下几个像素,因为按钮的背景图像中移动(实际上这感觉就像是运动的形象,因为首先有边框的按钮下,当它在pressed状态那么这个边界消失)。请参见下图。

When button is in normal state then it looks just fine. But when I press the button, I need to move text down few pixels because button background image moving (actually it feels like it moving on the image, because first there's border under the button and when it's in pressed state then this border disappears). Please see image below.

我如何可以移动的按钮,按钮的文字时,按钮状态pressed? (也许在某种程度上填补或布局定制的按钮)

How can I move the buttons text in the button when buttons state is pressed? (maybe padding somehow or layout custom for a button)

推荐答案

我没有尝试自己,但如果你用九个补丁作为背景绘制这两个州,那么你应该考虑在pressed设置适当的填充盒国家绘制。查看详情这里

I did not try it myself but if you use nine-patch as a background drawable for both states then you should consider setting proper padding box in pressed state drawable. See details here.

这篇关于如何将按钮文本时的状态是pressed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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