Common background image for Actionbar (Toolbar) and statusbar

后端 未结 1 1232
猫巷女王i
猫巷女王i 2020-12-18 04:06

I need to design something like this with Transparent Toolbar

But I am getting something like this

Design is like

  • transparent
相关标签:
1条回答
  • 2020-12-18 04:48

    to set image in action make your toolbar like this

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/float_transparent"
        app:popupTheme="@style/AppTheme.PopupOverlay" >
    
    
        <ImageView
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:scaleType="fitXY"
          android:src="@drawable/home_top_image"
       />
     </android.support.v7.widget.Toolbar>
    

    and in activity theme m change your primary color and primary dark color to transparent color

    like this

     <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
      <!-- Customize your theme here. -->
      <item name="colorPrimary">@android:color/transparent</item>
      <item name="colorPrimaryDark">@android:color/transparent</item>
      <item name="colorAccent">@color/colorAccent</item>
      <item name="android:windowTranslucentStatus">true</item>
      <item name="android:windowTranslucentNavigation">true</item>
     </style>
    
    0 讨论(0)
提交回复
热议问题