1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      Android中怎么實(shí)現(xiàn)京東搜索框漸變效果-創(chuàng)新互聯(lián)

      這篇文章給大家介紹Android中怎么實(shí)現(xiàn)京東搜索框漸變效果,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

      創(chuàng)新互聯(lián)專注于網(wǎng)站建設(shè),為客戶提供網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站制作、網(wǎng)頁設(shè)計(jì)開發(fā)服務(wù),多年建網(wǎng)站服務(wù)經(jīng)驗(yàn),各類網(wǎng)站都可以開發(fā),成都品牌網(wǎng)站建設(shè),公司官網(wǎng),公司展示網(wǎng)站,網(wǎng)站設(shè)計(jì),建網(wǎng)站費(fèi)用,建網(wǎng)站多少錢,價(jià)格優(yōu)惠,收費(fèi)合理。

      原理:就是自定義scrollview實(shí)現(xiàn)對(duì)滑動(dòng)高度的監(jiān)聽而已,如此實(shí)現(xiàn)對(duì)搜索框的漸變

      //自定義ScrollViewpublic class CustomView extends ScrollView { public interface ScrollViewListener { void onScrollChanged(CustomView customView, int x, int y, int oldx, int oldy); } private ScrollViewListener scrollViewListener = null; public CustomView(Context context) { super(context); } public CustomView(Context context, AttributeSet attrs,   int defStyle) { super(context, attrs, defStyle); } public CustomView(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollViewListener(ScrollViewListener scrollViewListener) { this.scrollViewListener = scrollViewListener; } @Override protected void onScrollChanged(int x, int y, int oldx, int oldy) { super.onScrollChanged(x, y, oldx, oldy); if (scrollViewListener != null) {  scrollViewListener.onScrollChanged(this, x, y, oldx, oldy); } }}


      好了,接下來就直接在邏輯代碼中調(diào)用就行了!

      @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); //搜索框在布局最上面 line.bringToFront(); mScrollview.setScrollViewListener(new CustomView.ScrollViewListener() {  @Override  public void onScrollChanged(CustomView customView, int x, int y, int oldx, int oldy) {  if (y <= 0) {   line.setBackgroundColor(Color.argb((int) 0, 227, 29, 26));//AGB由相關(guān)工具獲得,或者美工提供  } else if (y > 0 && y <= imageHeight) {   //獲取ScrollView向下滑動(dòng)圖片消失的比例   float scale = (float) y / imageHeight;   //更加這個(gè)比例,讓標(biāo)題顏色由淺入深   float alpha = (255 * scale);   // 只是layout背景透明   line.setBackgroundColor(Color.argb((int) alpha, 255, 255, 255));  }  } });

      關(guān)于Android中怎么實(shí)現(xiàn)京東搜索框漸變效果就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。


      標(biāo)題名稱:Android中怎么實(shí)現(xiàn)京東搜索框漸變效果-創(chuàng)新互聯(lián)
      標(biāo)題路徑:http://www.ef60e0e.cn/article/djopoo.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        盐池县| 盘山县| 嘉黎县| 长寿区| 临西县| 富川| 杭锦后旗| 蛟河市| 措美县| 栾城县| 奎屯市| 溧水县| 漳平市| 安多县| 新津县| 荆州市| 田林县| 定西市| 天气| 平果县| 安康市| 乐清市| 泽普县| 曲周县| 西青区| 建昌县| 临漳县| 怀来县| 巴林右旗| 山阴县| 团风县| 保亭| 关岭| 霍城县| 循化| 承德市| 安新县| 建昌县| 鸡西市| 南阳市| 富蕴县|