0

I want to remove space between in-built back arrow and SimpleDraweeView in toolbar.

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>

Snapshot shows space which I have to remove.

Space to remove

ChatActivity.java Set toolbar by activity. activity_container_void contains only an empty View.

@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);
}

Manifest.xml

<activity
        android:name=".home.chat.ChatActivity"
        android:parentActivityName=".home.MainActivity"/>

I tried different solutions, but none works. Please help me.

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
DrBomber
  • 25
  • 7
  • You need to set `toolbar` like this `toolbar=findViewById(R.id.toolbar); setSupportActionBar(toolbar);` – AskNilesh Aug 07 '18 at 11:41
  • @NileshRathod Error: This Activity already has an action bar supplied by the window decor. Also, if I set the ChatActivity theme with NoActionBar, the Toolbar is no longer visible – DrBomber Aug 07 '18 at 11:52

0 Answers0