Tôi cần tạo thanh công cụ của riêng mình trong ứng dụng Android. Có vẻ như sau: Xóa khoảng cách giữa các nút trong LinearLayout (Android)
Vì vậy, bạn thấy khoảng cách giữa các nút. Tôi đã cố gắng đặt lề/đệm âm ở các nút, nhưng không gian không biến mất.
Đây là mã bố trí:
<?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:orientation="vertical" >
<ListView
android:id="@+id/routes_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.5">
</ListView>
<TableRow
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:padding="0dp" >
<Button
android:id="@+id/btn_routes"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="0.2"
android:layout_marginRight="-10dp"
android:layout_marginLeft="-10dp"
android:text="@string/routes"
android:textSize="10dp" />
<Button
android:id="@+id/btn_places"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="0.2"
android:layout_marginRight="-10dp"
android:layout_marginLeft="-10dp"
android:textSize="10dp"
android:text="@string/places" />
<Button
android:id="@+id/btn_events"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="0.2"
android:layout_marginRight="-10dp"
android:layout_marginLeft="-10dp"
android:textSize="10dp"
android:text="@string/events" />
<Button
android:id="@+id/btn_about"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="0.2"
android:layout_marginRight="-10dp"
android:layout_marginLeft="-10dp"
android:text="@string/about"
android:textSize="10dp" />
</TableRow>
</LinearLayout>
Làm thế nào để loại bỏ khoảng cách giữa các nút?
Có lẽ bạn có thể kiểm tra điều này - http://stackoverflow.com/questions/2277732/how-to-get-rid-of-the-extra-gap-between-a-button-and-other-views –
Ý tưởng là sử dụng ImageButton với cùng màu nền. – hovanessyan