是否有可能更改Titanium中按鈕的背景圖像? 我有以下代碼爲我的按鈕:更改背景上的圖標按鈕懸停鈦
var btnLogin = Titanium.UI.createButton({
title : 'Log in',
top : '260',
height : '50',
width : '270',
backgroundImage : '../images/button.png'
});
是否有可能更改Titanium中按鈕的背景圖像? 我有以下代碼爲我的按鈕:更改背景上的圖標按鈕懸停鈦
var btnLogin = Titanium.UI.createButton({
title : 'Log in',
top : '260',
height : '50',
width : '270',
backgroundImage : '../images/button.png'
});
的URL是絕對的,與Resources
文件夾根:
var btnLogin = Titanium.UI.createButton({
title : 'Log in',
top : '260',
height : '50',
width : '270',
backgroundImage : '/images/button.png'
});
此外,如果你看一下文檔,它的確是可能的:http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Button-object
Rene的評論是有幫助的,但不是對問題的回答。
Rene沒有提供任何指示,當鼠標懸停在按鈕上時,可以指定單獨的backgroundimage。這是因爲恕我直言,沒有。
鈦是在考慮到移動設備的情況下開發的,因此觸摸屏。移動網站平臺一直是事後的想法。
據我所知,沒有辦法做「懸停」的東西,這對dekstop非常有用。 Android的軌跡球(有些設備顯然有一個)有一些調整,有一個'焦點'事件和一些屬性,如'backgroundFocusedColor',但那些不響應mobileweb上的懸停/鼠標懸停情況。
我很想被證明是錯誤的。
三星S4支持懸停。儘管在Titanium中找不到任何api來使用它。對於Android Native [this](http://developer.android.com/reference/android/view/View.OnHoverListener.html)將工作,我認爲。 – Dragon