可点击的相对布局
我有一个带有文本视图的可点击相对布局,我想围绕它创建一个轮廓,以允许用户意识到它是可点击的,但我不确定如何去做。任何帮助将不胜感激。
编辑:我已经实现了可点击性,也就是说,我已经能够单击它并让它执行某些操作。我只想在布局本身周围画一个框以表明它是可单击的。
I have a clickable relative layout with textviews that I want to create an outline around to allow users to realize that it is clickable, but I'm not sure how to go about doing this. Any help would be appreciated.
EDIT: I've already implemented clickability, that is, I'm already able to click it and have it do something. I merely want to draw a box around the layout itself to indicate that it is clickable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只想在relativelayout周围绘制一个框架,您可以非常简单地做到这一点。
因此,您的 XML 将如下所示:
现在您的相对布局周围有一个框(在本例中为蓝色)
这就是您要找的吗?
If you just want to draw a frame around a RelativeLayout, you can do that very simply.
So your XML will look something like this:
Now you have a box (in this case blue) around your Relative Layout
Is that what you were looking for?
View 有一个 xml 属性名称 android:onClick="methodName"。 LinearLayout、RelativeLayout继承View。您可以将方法名称设置为此属性。您的方法必须采用以下格式:
Action 方法必须是 public、void 并且具有参数类型 View。将此方法放在您的上下文(活动)中。
祝你好运 :)
View have an xml attribute name android:onClick="methodName". LinearLayout, RelativeLayout inherit View. You can set your method name to this attribute. Your method must have this format:
Action method must be public, void and have an parameter type View. Put this method on your context(Activity).
Good luck :)