代码之家  ›  专栏  ›  技术社区  ›  Tadas

Android工具栏背景[重复]

  •  0
  • Tadas  · 技术社区  · 8 年前

    这个问题已经有了答案:

    如何在工具栏上添加ImageView,使其位于抽屉和后箭头图标后面?该ImageView应该与工具栏高度匹配,并且左侧没有任何边距或填充。我现在正在尝试实现这一点,也是我发现的唯一一个定制工具栏的解决方案。

    例子:

    Toolbar example

    2 回复  |  直到 8 年前
        1
  •  0
  •   Shiva Snape    8 年前

      <RelativeLayout
                    android:id="@+id/my_toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    app:theme="@style/ActionBarThemeOverlay"
                    app:popupTheme="@style/ActionBarPopupThemeOverlay"
                    android:elevation="4dp"
                    android:background="@color/white">
    
                  <ImageView
                        android:layout_width="60dp"
                        android:layout_height="?attr/actionBarSize"
                        android:src="@drawable/yourImage"/>
    
        </RelativeLayout>
    
        2
  •  0
  •   user10041244    8 年前

    <android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/my_img"
    app:titleTextColor="@color/colorWhite"
    android:theme="@style/ThemeOverlay.AppCompat.Light"
    >
    </android.support.v7.widget.Toolbar>