0

Androidでアプリケーションを作成しようとしています。右の画像のようにボタンを透明にしたいのですが(Android 4.2.2でアプリケーションを実行したとき)、Android 2.3.3でアプリケーションを実行するとボタンが非透明で白くなりました(左のように) . 新しいバージョンのボタンのように見えるように、古いバージョンの透明なボタンに到達する方法はありますか?

ボタンの画像はこちら

(アプリケーションはチェコ語です。新しい英語の文字列を設定するのが面倒でした ;))

すべての返信に感謝します。下手な英語をお詫びします

4

2 に答える 2

1

単色とアルファを使用して形状を定義します。

myshape.xml

<?xml version="1.0" encoding="UTF-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
    <solid android:color="#42000000" />
</shape>

そしてそれをインサイダーに保存しred/drawableます。ボタンの背景として配置します。

于 2013-06-08T08:57:38.427 に答える
0

ボタンのバックグラウンドで以下の xml ファイルを使用します。

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_window_focused="false" android:state_enabled="true"
        android:drawable="@drawable/btn_default_normal_holo_dark" />
    <item android:state_window_focused="false" android:state_enabled="false"
        android:drawable="@drawable/btn_default_disabled_holo_dark" />
    <item android:state_pressed="true" 
        android:drawable="@drawable/btn_default_pressed_holo_light" />
    <item android:state_focused="true" android:state_enabled="true"
        android:drawable="@drawable/btn_default_focused_holo_dark" />
    <item android:state_enabled="true"
        android:drawable="@drawable/btn_default_normal_holo_dark" />
    <item android:state_focused="true"
        android:drawable="@drawable/btn_default_disabled_focused_holo_dark" />
    <item
         android:drawable="@drawable/btn_default_disabled_holo_dark" />
</selector>

btn_default_disabled_focused_holo_dark

btn_default_disabled_holo_dark btn_default_focused_holo_dark btn_default_normal_holo_dark

btn_default_pressed_holo_light

于 2013-06-08T08:59:07.093 に答える