2017-10-19 3 views
0

Ich mag wie in diesem Bild diesen Raum zwischen Symbol- und Textview entfernen:Wie Raum entfernen, in Toolbar

enter image description here

Ich versuche, Benutzer contentInsetStart und contentInsetEnd aber auch nicht. Dies ist mein vollständigen Code zu handhaben es

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/app_bar_height" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/ctl_news" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleTextAppearance="@style/CollapsingToolbarLayoutExpandedTextStyle" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

     <ImageView 
      android:id="@+id/iv_news_mainImage" 
      android:layout_width="match_parent" 
      android:layout_height="230dp" 
      android:scaleType="centerCrop" 
      android:src="@drawable/stripes" 
      app:layout_collapseMode="parallax" 
      app:layout_collapseParallaxMultiplier="0.7" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/tb_news" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
      app:layout_collapseMode="pin" 
      android:contentInsetEnd="0dp" 
      android:contentInsetStart="0dp" 
      app:contentInsetEnd="0dp" 
      app:contentInsetStart="0dp" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:titleTextAppearance="@style/Toolbar.TitleText"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/back" 
       android:gravity="top|end" 
       android:textColor="@color/white" 
       android:textSize="@dimen/text_huge_size" /> 
     </android.support.v7.widget.Toolbar> 

    </android.support.design.widget.CollapsingToolbarLayout> 

</android.support.design.widget.AppBarLayout> 

Kann jemand mir helfen, es zu lösen

+0

Nutzung der Schwerkraft.! oder align center true –

+0

In der TextView versuche 'android: gravity =" left "' –

Antwort

0

verwenden, um den App-Namensraum zu vermeiden und gehen sie wie folgt:

app:contentInsetLeft="0dp" 
app:contentInsetStart="0dp" 

Auch mögen Sie vielleicht hinzufügen:

app:contentInsetStartWithNavigation="0dp" 

Entfernen Sie das contentInsetEnd-Attribut. Ich habe versucht, und das funktioniert

So sieht es wie folgt aus:

<android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     app:contentInsetLeft="0dp" 
     app:contentInsetStart="0dp" 
     app:contentInsetStartWithNavigation="0dp" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 
0

Sie app:titleMarginStart="0dp" versuchen Sie?

sollten Sie verwenden app Präfix für contentInsetStart und contentInsetEnd und die Androiden entfernen Standardcode

+0

ich probiere es auch, aber arbeite nicht auch entferne 'android' prefix und dasselbe ergebnis – Ahmed

+0

Probieren Sie' app: contentInsetStartWithNavigation' noch aus? – nhoxbypass

Verwandte Themen