[英]AutoCompleteTextView - How to remove margin from top and bottom?
[英]android -how to remove margin from top and bottom of custom actionbar
我正在为我的应用程序使用自定义操作栏。 这是代码:
actionBar.setDisplayShowCustomEnabled(true);
getSupportActionBar().setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setHomeButtonEnabled(false);
actionBar.setIcon(null);
actionBar.setCustomView(mCustomView);
Toolbar parent =(Toolbar) mCustomView.getParent();
parent.setContentInsetsAbsolute(0, 0);
这是这段代码的结果,我有顶部和底部的边距:
我怎样才能删除这个边距?
我使用 Theme.AppCompat.Light 作为我的应用程序模板。
建议将 Toolbar 布局 xml 放在单独的文件中:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/actionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp" >
然后将其包含在您的 main.xml 中
<include layout="@layout/view_action_bar" />
还要确保: app:contentInsetStart="0dp"
这是您的主要问题。
在您的 ActionBar 布局文件中,将 android:heigth 作为父视图的匹配父项。 我也有同样的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.