Android ActionBar標題和漸變背景

2021-09-08 03:47:54 字數 987 閱讀 1896

需要在androidmanifest.xml中設定

如果提示找不到,請按下圖設定:

至於如何引入的方法,請看前一篇。

一。使用作為背景

直接在**中引用即可

二。使用漸變顏色作為背景

2.1 生成actionbar_gradient_bg.xml 檔案

<?xml version="

1.0" encoding="

utf-8

"?>

""android:shape="

rectangle

">

android:angle="

270"

android:endcolor="

#ff8c00

"android:startcolor="

#ffffff

"android:type="

linear

" />

2.2 在**中指定 

//設定漸變色背景

標題欄漸變效果

一 效果圖 三 自定義view,這裡面我繼承的是scrollview public class boxdetailscrollview extends scrollview public boxdetailscrollview context context,attributeset attrs,i...

實現ScrollView頭標題滑動漸變

scrollview滑動監聽 google並沒有給我們提供scrollview的滑動距離 是否滑動到布局底部 頂部的方法,但是提供了乙個onscrollchanged方法 override protected void onscrollchanged int x,int y,int oldx,int...

線性漸變和徑向漸變

linear gradient direction,color 寫法 background webkit linear gradient direction,color 1.direction 方向,預設方向是自上而下 寫法有 1.background webkit linear gradient ...