Đã giải quyết một chút về câu hỏi này. Đã làm một giải pháp dựa trên linearLayouts với 1dp lượt xem như ngăn và nền trong suốt để có được cái nhìn tối giản trên các nút.
Chúng tôi muốn các nút để thay đổi apperance tùy thuộc vào trạng thái của nút. (Xem thêm tại đây hello form stuff tutorial). Chúng tôi thay đổi màu nền để người dùng nhận được chỉ báo khi nhấn nút.
borderless_background.xml (đi trong thư mục drawable)
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="#33b5e5" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="#0099cc" />
</shape>
</item>
<item>
<shape>
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>
Các main.xml sau đó sẽ sử dụng tập tin borderless_background, xem android: thẻ nền cho các nút trong đoạn mã sau
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp"
android:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="1.0"
android:textSize="14sp"
android:text="@string/borderless" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:textSize="12sp"
android:autoLink="web"
android:text="@string/source1" />
<View
android:id="@+id/horizontal_divider1"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_weight="1.0"
android:background="@drawable/borderless_background"
android:textColor="@android:color/white"
android:textSize="16sp"
android:text="Cancel"
android:onClick="cancel" />
<View
android:id="@+id/vertical_divider"
android:layout_width="1dip"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_height="fill_parent"
android:background="@android:color/darker_gray" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_weight="1.0"
android:background="@drawable/borderless_background"
android:textColor="@android:color/white"
android:textSize="16sp"
android:text="Next"
android:onClick="next" />
</LinearLayout>
<View
android:id="@+id/horizontal_divider2"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
</LinearLayout>
Có những cảnh báo liên quan đến hiệu suất vì các layuots tuyến tính lồng nhau nhưng điều chạy tốt trên máy tính bảng tôi đã thử nghiệm trên vì vậy tôi quá lười biếng để sửa lỗi này. Bản sửa lỗi có thể dựa trên bố cục tương đối hoặc bố cục lưới.
Hãy cho tôi biết nếu bạn cần giúp đỡ với draw9patch. Tôi đã thực hiện nó trước đây, vì vậy tôi rất vui khi được giúp đỡ. – EGHDK