自定义皮肤问题?望高手相助
以下是部分代码,不知道为什么报错为system error-1;单步调试在SetLocalItemDefL()函数就走不下去了!
_LIT(KMbmPath, "\\resource\\apps\\Company.mbm");
TFileName fileName(KMbmPath);
User::LeaveIfError(CompleteWithAppPath(fileName));
iBgBitmap = new (ELeave) CFbsBitmap();
User::LeaveIfError(iBgBitmap->Load(fileName, EMbmCompanyBackground_));
TFileName fn = Application()->BitmapStoreName();
const TAknsItemID id = KAknsIIDQsnFrPopupSub;//KAknsIIDQsnFrPopupPreview;
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
CAknsItemData* item = skin->GetCachedItemData(id);
if (item == NULL)
{
item = skin->CreateUncachedItemDataL(id);
}
if (item->Type() == EAknsITMaskedBitmap)
{
CAknsItemDef* def = AknsUtils::CreateMaskedBitmapItemDefL(
id, fn, EMbmCompanyBackground_,
EMbmCompanyBackground_);
skin->SetLocalItemDefL(def);
}
else
{
CAknsItemDef* def = AknsUtils::CreateBitmapItemDefL(
id, fn, EMbmCompanyBackground_);
skin->SetLocalItemDefL(def);
}[/size][/size]
[解决办法]
检查下你的fileName和fn值是否相同,一般这错误表示你的资源找不到,大概就是fn值不对,使用fileName应该没错~