簡體   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