我正在创建一个自定义的主页图标。自定义代码如下,
View customView = getLayoutInflater().inflate(R.layout.action_bar_display_options_custom, null);
customView.findViewById(R.id.action_home).setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
toggle();
}
});
actionBar.setCustomView(customView, new ActionBar.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
actionBar.setDisplayShowCustomEnabled(true);
这是action_bar_display_options_custom.xml
,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/action_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_home" />
<TextView
android:id="@+id/action_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /> </LinearLayout>
这是截图,
这是主页的图标(该空间不是图像视图的一部分),
那么,如何删除视图前面的空间?