我想在Android中堆疊多個(圓形)按鈕。這是我想實現的:http://imageshack.us/photo/photo/19/0gp1.jpg/在RelativeLayout中堆疊按鈕
我試圖把多個按鈕放在一個RelativeLayout中(並將它們的位置設置爲絕對位置),但是這並沒有給出我想要達到的結果,因爲按鈕並沒有實現, t在不同密度/屏幕尺寸下具有正確的位置。有沒有人有這種按鈕/佈局的經驗?我能做些什麼來達到這個結果?
我想在Android中堆疊多個(圓形)按鈕。這是我想實現的:http://imageshack.us/photo/photo/19/0gp1.jpg/在RelativeLayout中堆疊按鈕
我試圖把多個按鈕放在一個RelativeLayout中(並將它們的位置設置爲絕對位置),但是這並沒有給出我想要達到的結果,因爲按鈕並沒有實現, t在不同密度/屏幕尺寸下具有正確的位置。有沒有人有這種按鈕/佈局的經驗?我能做些什麼來達到這個結果?
使它在一個RelativeView中,首先構建btn1,然後btn2,然後在另一個RelativeLayout btn3和btn4上,最後btn 5並給出背景圖像。你應該做的就是照顧他們的尺寸。
編輯:
這裏是我寫的任何代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<Button
android:id="@+id/btn1"
android:layout_width="250dp"
android:layout_height="180dp"
android:text="btn1" />
<Button
android:id="@+id/btn2"
android:layout_width="250dp"
android:layout_height="70dp"
android:layout_below="@+id/btn1"
android:text="btn2" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<Button
android:id="@+id/btn3"
android:layout_width="150dp"
android:layout_height="75dp"
android:text="btn3" />
<Button
android:id="@+id/btn4"
android:layout_width="150dp"
android:layout_height="75dp"
android:layout_below="@+id/btn3"
android:text="btn4" />
<Button
android:id="@+id/btn5"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:text="btn5" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
要創建這種類型的buttons
你必須削減Image
成不同的尺寸,並把它ImagesButton
裏面Layout
和使用它非常簡單。
你可以創建這樣的drawables並將按鈕放在另一個頂部 –
你需要使用ImageButton – KOTIOS
我知道,但按鈕仍然是一個方形 – matthijs2704