不支持Android這種按鈕像上面?
的按鈕是鍵盤,如果按正確的,裏面的文字會向右移動,並更改爲下一個選擇,否則按向左,向左文本將移動...
任何想法,對於這種按鈕?
謝謝!
不支持Android這種按鈕像上面?
的按鈕是鍵盤,如果按正確的,裏面的文字會向右移動,並更改爲下一個選擇,否則按向左,向左文本將移動...
任何想法,對於這種按鈕?
謝謝!
嗨請使用所提供的開關按鈕由Android
http://developer.android.com/guide/topics/ui/controls/togglebutton.html
你不能讓一個按鈕,按受壓面作用不同。但您可以設計一個「水平」線性佈局。
- 創建2個Imageviews(1左,1右)
-place內部的LinearLayout(水平方向)
-set不同的onClick處理函數,這些2控制爲每個這些
嘗試此使用的RelativeLayout ::
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rlt1"
tools:context=".MainActivity" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg" >
<ImageButton
android:id="@+id/leftArrowId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="24dp"
android:src="@drawable/larrow" />
<ImageButton
android:id="@+id/rightArrowId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="24dp"
android:src="@drawable/rarrow" />
</RelativeLayout>
採取兩種不同的箭頭圖標,一個左,右和每一個背景圖像您圖像
backgound圖像BG將
左箭頭將
右箭頭將
你可以做這個按鈕的三個版本。 1.喜歡它,2.如果你點擊右側,看起來像什麼,3.如果你點擊左側,看起來像什麼。那麼你使用imageview來顯示圖像和處理點擊自己 – MalaKa
看到我的答案,我已經發布完整解決佈局 –