你不能移動它更接近。你唯一的選擇,如果你想擁有它們更接近一起建設自己的按鈕:
<RelativeLayout
android:id="@+id/rlButton"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tvText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_text"/>
<ImageView
android:id="@+id/ivLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/home_icon"
android:layout_toLeftOf="@id/tvText"/>
</RelativeLayout>
你可以用保證金來控制TextView
和ImageView
之間的距離。您可以使用它幾乎相同的按鈕:
RelativeLayour rlButton = (RelativeLayout) view.findViewById(R.id.rlButton);
rlButton.setOnClickListener(new OnClickListener() {
....
});
但是,當然,你有你的按鈕樣式應用到RelativeLayout的,所以它看起來一樣的按鈕。