我已经按照描述制作了一个自定义按钮栏here https://stackoverflow.com/questions/2422689/creating-a-custom-compound-button-bar.
现在,我想在第一个和第二个按钮之间以及第二个和第三个按钮之间添加分隔符。我的按钮栏定义如下:
<LinearLayout
android:id="@+id/buttonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/buttonbarstyle"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
>
<ImageButton
android:id="@+id/buttonBarImageButton1"
android:scaleType="centerInside"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
android:src="@drawable/copy"
android:padding="2dip"
android:background="@drawable/buttonbar_background_selector"
android:layout_gravity="center_vertical"
/>
<ImageButton
android:id="@+id/buttonBarImageButton2"
android:scaleType="centerInside"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
android:src="@drawable/options"
android:padding="2dip"
android:background="@drawable/buttonbar_background_selector"
android:layout_gravity="center_vertical"
/>
<ImageButton
android:id="@+id/buttonBarImageButton3"
android:scaleType="centerInside"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"
android:src="@drawable/media_play"
android:padding="2dip"
android:background="@drawable/buttonbar_background_selector"
android:layout_gravity="center_vertical"
/>
</LinearLayout>
这个任务看起来很简单,但我找不到好的方法来完成它。每个按钮之间应该有一个灰色的分隔符,所以它看起来有点像this http://newsrob.blogspot.com/2010/12/newsrob-november-release-45.html.
我确信这很容易,请给我指出正确的方向。
将其放在每个按钮之间。
<View android:layout_height="fill_parent"
android:layout_width="2px"
android:background="#90909090"/>
应该会给你一个细长的灰色垂直条。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)