this is the layout code
<LinearLayout
android:id="@+id/mapOptions"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@color/white" >
<View
android:id="@+id/mapOptionMenuShade"
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:background="?android:attr/dividerVertical" />
<Button
android:id="@+id/BtnMap"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:text="@string/map" />
<View
android:id="@+id/Shade2"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:background="?android:attr/dividerVertical" />
<Button
android:id="@+id/BtnSatellite"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:text="@string/satellite" />
<View
android:id="@+id/Shade3"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:background="?android:attr/dividerVertical" />
<Button
android:id="@+id/BtnHybrid"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:text="@string/hybrid" />
</LinearLayout>
But with those “View” i can’t get to show my buttons.
Link for the google’s example for borderland buttons. This is why i implimented thos views.
Here i want to show 3 borderless buttons that fills the whole linear layout.
|-1–|-2–|-3–|
|—-|—-|—-|
Thank you
Instead of using
Buttonyou can use any View and attach onClickListener to it. So if you want borderless button, useTextViewinstead and you will get what you want. Try:instead of your
(basically start with replacing
ButtonwithTextView). Remember to adjust your code if you callfindViewById()and cast result toButtonyou will get Cast Exception if you left it not updated.EDIT
Alternative approach is described in developers’ docs “Borderless button”, however it requires device running at least API11 (Honeycomb), so use wisely.