1

歪んだ形状のボタンを作成することは可能ですか?
(つまり、通常の正方形または長方形のボタンではなく、画面の左下から画面の右上までのストライプ形状のように)?

この画像のようなものhttp://www.codeproject.com/KB/silverlight/SilverLightFAQPart2/9.JPG
そして、クリック可能な領域も色付きのものであることを確認する必要があります。

ありがとう、

ティー

4

2 に答える 2

0

そのためには、独自のクラスを作成する必要があります。View をサブクラス化し、onClick イベントをリッスンするだけです。

于 2010-03-13T05:38:55.793 に答える
0

背景としてセレクターを使用してみてください。

    <Button 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/hello" 
        android:background="@drawable/my_button" 
    /> 

そして、ドローアブル フォルダーにmy_button.xmlを作成します。

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/focused" /> 
    <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focusedpressed" /> 
    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" /> 
    <item android:drawable="@drawable/defaultbutton" /> 
</selector>

ソース: http://www.anddev.org/tinytutcustom_button_backgrounds-better_imagebutton-t4298.html

于 2010-03-13T10:12:10.193 に答える