java - 删除工具栏中 ImageView 和后退箭头之间的空间
问题描述
我想删除工具栏中内置后退箭头和 SimpleDraweeView 之间的空格。
fragment_chat_profile.xml
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fresco="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay" >
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:popupTheme="@style/AppTheme.PopupOverlay" >
<ImageView
android:id="@+id/profile_photo"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/default_profile" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
快照显示我必须删除的空间。
ChatActivity.java 按活动设置工具栏。activity_container_void 只包含一个空视图。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_container_void);
ActionBar actionBar = getSupportActionBar();
View customView = LayoutInflater.from(this).inflate(R.layout.fragment_chat_profile, null);
Objects.requireNonNull(actionBar).setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setCustomView(customView);
}
清单.xml
<activity
android:name=".home.chat.ChatActivity"
android:parentActivityName=".home.MainActivity"/>
我尝试了不同的解决方案,但没有一个有效。请帮我。
解决方案
推荐阅读
- regex - 正则表达式搜索特定字段的全文
- java - 使用jsp的测验应用程序
- php - PHP分页循环没有可见链接
- java - 从 String 类的 .equals() 方法获取 NPE。如何调试这个
- actions-on-google - 谷歌智能家居第三方后台调用首页图错误
- heroku - 邮件因“已达到最大排队时间”消息而被阻止。Heroku,SendGrid
- list - 为什么我的自定义比较器只进行一次比较?
- jquery - 将 Javascript Fetch 请求转换为 Angular Http 客户端不起作用
- github - GitHub 项目板未与 repo 一起复制;这可能吗?
- email - Sping 集成邮件空闲入站适配器中的问题