Flex (モバイルアプリ用) でリスト項目を透明な背景でレンダリングすることは可能ですか?
私のアプリのデザインには、表示されたままにする必要がある背景が含まれています。
contentBackgroundAlpha を 0 に設定しようとしましたが、アイテム レンダラーには影響しません。また、alternativeItemColors="[0xffffffff, 0xffffffff]" を試してみましたが、まだ不透明です。
他の回避策はありますか?それは可能ですか?
ありがとう。
Flex (モバイルアプリ用) でリスト項目を透明な背景でレンダリングすることは可能ですか?
私のアプリのデザインには、表示されたままにする必要がある背景が含まれています。
contentBackgroundAlpha を 0 に設定しようとしましたが、アイテム レンダラーには影響しません。また、alternativeItemColors="[0xffffffff, 0xffffffff]" を試してみましたが、まだ不透明です。
他の回避策はありますか?それは可能ですか?
ありがとう。
あなたは物件を探していると思います:
contentBackgroundAlpha="0"
次に、ItemRenderer で:
override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
{
// transparent background for hit detection
graphics.beginFill(0xFFFFFF, 0);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
// turn off opaqueBackground since this renderer has some transparency
opaqueBackground = null;
if (selected || hovered) {
this.setStyle('color', 0x94734D);
}
}
]]>
</fx:Script>
これが私の実装です:
1) これを List のカスタム IconItemRenderer に追加します。
override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
{
if (itemIndex % 2 == 0)
{
graphics.beginFill(0xFFFFFF, 0);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
else
{
// transparent background for hit detection
graphics.beginFill(0x004f94, 0.1);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
opaqueBackground = null;
if (selected)
{
// transparent background for hit detection
graphics.beginFill(0x004f94, 0.2);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
}
2) これをリストのプロパティに追加します。
contentBackgroundAlpha="0.5"
alpha="0.5"