繁体   English   中英

Android控件小部件布局

[英]Android control widget layout

我正在尝试制作一个小部件,它是一个类似于android控件小部件(WLAN,蓝牙等的快速设置)中的切换按钮。

这是它的外观 (@Control Widgets)

有谁知道这个布局是否包含在android sdk中,或者如果不可以,我该如何制作一个布局呢?

我已经尝试过一些方法,但是我不知道如何对底部的笔触进行处理。

关于您的问题,我进行了更深入的搜索。

请参阅: https//developer.android.com/guide/topics/appwidgets/index.html

这些是可以与appwidget一起使用以在布局中实现的类,没有像切换按钮之类的东西,但是有一个imagebutton,我认为我们正是Google用于“切换按钮”的东西。 仔细看一下imagebutton: https : //developer.android.com/reference/android/widget/ImageButton.html

然后,您会发现它正是您想要的。

    By default, an ImageButton looks like a regularButton, with the standard button background that changes color during different button states. The image on the surface of the button is defined either by the android:src attribute in the XML element or by thesetImageResource(int) method.

我无法想象仅使用干净的xml就可以实现如此复杂的布局...

希望现在对您有所帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM