精华内容
下载资源
问答
  • 背景图片跟着切换。 //伸缩列表 $(function(){ $(".gao_fourXuan li").eq(0).click(function(){ if($("#baram").css("display")=='none'){ $(".gao_fourXuan li").removeClass("gao_fourXuanli2")...

    1.伸缩栏内容

    <div class="gao_fourXuan">
        <ul>
        <li>1栏</li>
        <li>2栏</li>
        <li>3栏</li>
        <li>4栏</li>
        </ul>
        </div>
            <div   id="baram"  class="gao_shaiXuanpai">
                <ul>
                     栏一列表
                </ul>
            </div>
            <div id="pctprice" class="gao_shaJiage">
                <ul>
                     栏二列表
                </ul>
            </div>
              <div id="province" class="gao_shaJiage">
              <ul>
                     栏三列表
                </ul>
            </div>
                  <div id="fourg" class="gao_shaJiage">
                <ul>
                     栏四列表
                </ul>
            </div>

    //伸缩列表
    $(function(){
    $(".gao_fourXuan li").eq(0).click(function(){
    $("#baram").slideToggle("slow");
    $("#fourg").hide();
    $("#province").hide();
    $("#pctprice").hide();
    })
    $(".gao_fourXuan li").eq(1).click(function(){
    $("#baram").hide();
    $("#fourg").hide();
    $("#province").hide();
    $("#pctprice").slideToggle("normal");
    })
        $(".gao_fourXuan li").eq(2).click(function(){
        $("#pctprice").hide();
    $("#baram").hide();
    $("#fourg").hide();
    $("#province").slideToggle("slow");
    })
        $(".gao_fourXuan li").eq(3).click(function(){
        $("#province").hide();
    $("#pctprice").hide();
    $("#baram").hide();
    $("#fourg").slideToggle("normal");

    })

    })



    2.伸缩栏内容升级版("栏位每个标签点击后切换图片")

    .gao_fourXuanli2  {float: left;width: 19%;background: url("../../images/wechat/gao_liBg2.gif") 87% 50% no-repeat !important;color: #565656;font-size: 14px;background-size: 20% 80% !important;margin: 2% 0px 2% 1%;padding-left: 4.6%;border-right: 1px solid #bfbfbf;}

    即栏内容伸缩的同时栏位:   

        <li>1栏</li>
        <li>2栏</li>
        <li>3栏</li>
        <li>4栏</li>

    的背景图片跟着切换。

    //伸缩列表
    $(function(){
    $(".gao_fourXuan li").eq(0).click(function(){
    if($("#baram").css("display")=='none'){
    $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
     $(this).addClass("gao_fourXuanli2");
    }else if($("#baram").css("display")=='block'){
    $(this).removeClass("gao_fourXuanli2");
    };
    $("#baram").slideToggle("slow");
    $("#fourg").hide();
    $("#province").hide();
    $("#pctprice").hide();
    })
    $(".gao_fourXuan li").eq(1).click(function(){
    if($("#pctprice").css("display")=='none'){
    $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
     $(this).addClass("gao_fourXuanli2");
    }else if($("#pctprice").css("display")=='block'){
    $(this).removeClass("gao_fourXuanli2");
    };
    $("#baram").hide();
    $("#fourg").hide();
    $("#province").hide();
    $("#pctprice").slideToggle("normal");
    })
        $(".gao_fourXuan li").eq(2).click(function(){
        if($("#province").css("display")=='none'){
         $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
     $(this).addClass("gao_fourXuanli2");
    }else if($("#province").css("display")=='block'){

    $(this).removeClass("gao_fourXuanli2");
    };
        $("#pctprice").hide();
    $("#baram").hide();
    $("#fourg").hide();
    $("#province").slideToggle("slow");
    })

    3.终极修改伸缩栏(因为发现之前的有个bug所以改为如下,而且使用hide和show快速切换时候出现jquery的bug,换成了fadein,fadeout)

    修改如下:

    //伸缩列表
    $(function(){
    $(".gao_fourXuan li").eq(0).click(function(){
    if($("#baram").css("display")=='none'){
    $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
       $(this).addClass("gao_fourXuanli2");
       $("#baram").fadeIn("slow");
       $("#fourg,#province,#pctprice").fadeOut();
    }else if($("#baram").css("display")=='block'){
    $(this).removeClass("gao_fourXuanli2");
       $("#baram").fadeOut("slow");
    };
    })
    $(".gao_fourXuan li").eq(1).click(function(){
    if($("#pctprice").css("display")=='none'){
    $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
     $(this).addClass("gao_fourXuanli2");
     $("#pctprice").fadeIn("normal");
     $("#baram,#fourg,#province").fadeOut();
    }else if($("#pctprice").css("display")=='block'){
    $(this).removeClass("gao_fourXuanli2");
    $("#pctprice").fadeOut("normal");
    };
    })
        $(".gao_fourXuan li").eq(2).click(function(){
        if($("#province").css("display")=='none'){
         $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
     $(this).addClass("gao_fourXuanli2");
     $("#province").fadeIn("slow");
     $("#pctprice,#baram,#fourg").fadeOut();
    }else if($("#province").css("display")=='block'){
    $(this).removeClass("gao_fourXuanli2");
    $("#province").fadeOut("slow");
    };
       

    })
        $(".gao_fourXuan li").eq(3).click(function(){
        if($("#fourg").css("display")=='none'){
        $(".gao_fourXuan li").removeClass("gao_fourXuanli2");
     $(this).addClass("gao_fourXuanli2");
     $("#fourg").fadeIn("normal");
     $("#province,#pctprice,#baram").fadeOut();
    }else if($("#fourg").css("display")=='block'){
    $(this).removeClass("gao_fourXuanli2");
    $("#fourg").fadeOut("normal");
    };
    })
    })

    展开全文
  • From google: If your app uses a custom image as the background of the bar,...一句话:将原来的44(88)像素的背景图片改为64(128)像素高度的图片即可。 转载于:https://www.cnblogs.com/ilovewindy/p/3977912.html

    From google: If your app uses a custom image as the background of the bar, you'll need to provide a “taller” image so that it extends up behind the status bar. The height of navigation bar is changed from 44 points (88 pixels) to 64 points (128 pixels).

    一句话:将原来的44(88)像素的背景图片改为64(128)像素高度的图片即可。

    转载于:https://www.cnblogs.com/ilovewindy/p/3977912.html

    展开全文
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">... <...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <title>Document</title>
        <style>
            .box { width: 600px; height: 600px; box-shadow: inset 0 60px rgba(255,255,255,.2), inset 0 0 300px rgba(255,255,255,.1), inset 50px -20px 0 rgba(255,255,255,.1), inset -300px 120px rgba(255,255,255,.06); -webkit-transition: background-color .25s; transition: background-color .25s; overflow: hidden; position: relative;}
            #title{position: absolute;width: 100%;height: 40px;line-height: 40px;z-index: 9000;text-align: center;color:#fff;
    box-shadow: 2px 2px 2px rgba(0,0,0,.2);-webkit-box-shadow: 2px 2px 2px rgba(0,0,0,.2);-moz-box-shadow: 2px 2px 2px rgba(0,0,0,.2);-o-box-shadow: 2px 2px 2px rgba(0,0,0,.2);-ms-box-shadow: 2px 2px 2px rgba(0,0,0,.2);
            }
            .list { width: 600px; height: 600px; position: absolute; text-align: center; }
            .list > img { vertical-align: middle; box-shadow: 0 0 10px rgba(0,0,0,.35) }
            .list::after { content: ''; display: inline-block; width: 0; height: 100%; vertical-align: middle; }
            .index { width: 600px; margin-top: 20px; text-align: center; }
            a { display: inline-block; margin: 0 2px; width: 16px; height: 16px; line-height: 16px; border-radius: 14px; background-color: #ddd; text-align: center; color: #333; font-family: 'microsoft yahei'; font-size: 12px; }
            a:hover { text-decoration: none; }
            .active { background-color: #cd0000; color: #fff; }
            #show{width: 20px;height: 20px;border: 1px solid #ddd;}
        </style>
    </head>
    <body>
        <div id="box" class="box">
            <div id="title">这是一个测试</div>
            <div id="list1" class="list"><img src="imgs/1.jpg"></div>
            <div id="list2" class="list"><img src="imgs/2.jpg"></div>
            <div id="list3" class="list"><img src="imgs/3.jpg"></div>
            <div id="list4" class="list"><img src="imgs/4.jpg"></div>
        </div>
        <div id="index" class="index">
            <a>1</a>
            <a>2</a>
            <a>3</a>
            <a>4</a>
        </div>
        <div id="show"></div>
    </body>
    </html>
    <script src="jquery-1.10.2.js"></script>
    <script src="rgbaster.js"></script>
    <script>
        $(function(){
            $("#index").find("a").click(function(){
                var index=$(this).index()+1;
                var list=$("#list"+index);
                list.show();
                list.siblings(".list").hide();
                var src=list.find("img").attr("src");
                RGBaster.colors(src, {
                    paletteSize: 30, // 调色板大小
                      exclude: [ 'rgb(255,255,255)','rgb(0,0,0)' ],  // 为了使取色更合理,排除白色,黑色
                    success: function(payload) {
                        // payload.dominant是主色,RGB形式表示
                        // payload.secondary是次色,RGB形式表示
                        // payload.palette是调色板,含多个主要颜色,数组    
                        var color1=MixColor1(payload.secondary,0.8);
                        var color2=MixColor3(payload.secondary,payload.dominant,0.7);
                        console.log(payload.dominant);
                        $("#title").css("background-color",color2);
                        $("#show").css("background-color",color2);
                    }
                });            
            })    
        })
    
        //与白色按比例进行混合
        function MixColor1(rgb,rate){
            var regexp = /[0-9]{0,3}/g;  
               var re = rgb.match(regexp);
               var color1 = [];
               var color2 = [255,255,255];
               var rate1=rate,rate2=1-rate1;
    
            for (var i = 0; i < re.length; i++) {
                   var t = re[i];
                   if(t!==""){
                       color1.push(parseInt(t));
                   }
           }
    
           var r=parseInt(color1[0]*rate1+color2[0]*rate2);
           var g=parseInt(color1[1]*rate1+color2[1]*rate2);
           var b=parseInt(color1[2]*rate1+color2[2]*rate2);
               return "rgb("+r+","+g+","+b+")";
        }
    
        //主色和次色按比例进行混合
        function MixColor2(rgb1,rgb2,rate){
            var regexp = /[0-9]{0,3}/g;  
               var re1 = rgb1.match(regexp);
               var re2 = rgb2.match(regexp);
               var color1 = [];
               var color2 = [];
               var rate1=rate,rate2=1-rate1;
    
            for (var i = 0; i < re1.length; i++) {
                   var t1 = re1[i];
                   var t2 = re2[i];
                   if(t1!==""){
                       color1.push(parseInt(t1));
                       color2.push(parseInt(t2));
                   }
           }
    
           var r=parseInt(color1[0]*rate1+color2[0]*rate2);
           var g=parseInt(color1[1]*rate1+color2[1]*rate2);
           var b=parseInt(color1[2]*rate1+color2[2]*rate2);
               return "rgb("+r+","+g+","+b+")";
        }
    
        //主色、次色和白色按比例进行混合,白色占比20%
        function MixColor3(rgb1,rgb2,rate){
            var regexp = /[0-9]{0,3}/g;  
               var re1 = rgb1.match(regexp);
               var re2 = rgb2.match(regexp);
               var color1 = [];
               var color2 = [];
               var color3 = [255,255,255];
               var rate1=rate*0.8,rate2=(1-rate)*0.8,rate3=0.2;
    
            for (var i = 0; i < re1.length; i++) {
                   var t1 = re1[i];
                   var t2 = re2[i];
                   if(t1!==""){
                       color1.push(parseInt(t1));
                       color2.push(parseInt(t2));
                   }
           }
    
           var r=parseInt(color1[0]*rate1+color2[0]*rate2+color3[0]*rate3);
           var g=parseInt(color1[1]*rate1+color2[1]*rate2+color3[1]*rate3);
           var b=parseInt(color1[2]*rate1+color2[2]*rate2+color3[2]*rate3);
               return "rgb("+r+","+g+","+b+")";
        }
    </script>

     

    注:提供三种颜色混合方式,主次混合颜色偏暗,与白色混合颜色偏淡,建议主次白3色混合

    Github项目地址是:https://github.com/briangonzalez/rgbaster.js

    核心script地址:<script src="http://rawgit.com/briangonzalez/rgbaster.js/master/rgbaster.js"></script>

    转载于:https://www.cnblogs.com/xuhang/p/4764145.html

    展开全文
  • 设置标题栏背景 1> 准备背景图片: background_pix.png 注:用背景图片比用颜色好处,可以让背景看起来有凹凸感. 2> drawable文件夹下放xml文件 bitmap_repeat.xml <?xml version=1.0 encoding=utf-8?> ...
  • Android沉浸式状态栏+图片背景+标题栏渐变+背景伸缩 PersonView 自定义ScrollView实现Toolbar(标题栏)渐变 效果如: 编程思想: 1、自定义一个类,继承自ScrollView,并重写它的 onScrollChanged 方法; ...

    Android沉浸式状态栏+图片背景+标题栏渐变+背景伸缩

    今天做项目时,刚好用到了一部分Android沉浸式状态栏的技术,我就单独写了出来
    该部分代码在PersonView中
    首先是自定义ScrollView实现Toolbar(标题栏)渐变

    效果展示图:
    在这里插入图片描述
    编程思想:

    1、自定义一个类,继承自ScrollView,并重写它的 onScrollChanged 方法;

    2、在 onScrollChanged 中获取 ScrollView 在Y轴的移动距离,并根据此距离改变 Toolbar(标题栏) 的透明度。
    示例代码:
    类:MainActivity.java

    package com.example.personview;
    
    import android.os.Bundle;
    import android.support.annotation.Nullable;
    import android.view.Gravity;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.LinearLayout;
    import android.widget.Toast;
    
    import com.example.personview.base.BaseActivity;
    import com.example.personview.impl.ActionBarClickListener;
    import com.example.personview.widget.TranslucentActionBar;
    import com.example.personview.widget.TranslucentScrollView;
    
    
    /**
     * Created by Administrator
     * time:2019/8/13
     */
    
    public class MainActivity extends BaseActivity implements ActionBarClickListener, TranslucentScrollView.TranslucentChangedListener, View.OnClickListener {
    
        private TranslucentScrollView translucentScrollView;
        private TranslucentActionBar actionBar;
        private View zoomView;
    
        @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            init();
            initClick();//初始化点击事件
        }
    
        private void init() {
            actionBar = (TranslucentActionBar) findViewById(R.id.actionbar);
            //初始actionBar
            actionBar.setData("个人中心", 0, null, 0, null, null);
            //开启渐变
            actionBar.setNeedTranslucent();
            //设置状态栏高度
            actionBar.setStatusBarHeight(getStatusBarHeight());
    
            translucentScrollView = (TranslucentScrollView) findViewById(R.id.pullzoom_scrollview);
            //设置透明度变化监听
            translucentScrollView.setTranslucentChangedListener(this);
            //关联需要渐变的视图
            translucentScrollView.setTransView(actionBar);
    
            zoomView = findViewById(R.id.lay_header);
            //关联伸缩的视图
            translucentScrollView.setPullZoomView(zoomView);
        }
    
        @Override
        public void onLeftClick() {
    
        }
    
        @Override
        public void onRightClick() {
    
        }
    
        @Override
        public void onTranslucentChanged(int transAlpha) {
            actionBar.tvTitle.setVisibility(transAlpha > 48 ? View.VISIBLE : View.GONE);
        }
    
        /**
         * 初始化点击事件
         * 获取布局文件toast_signtoday.xml里的控件
         **/
        private void initClick() {
            LinearLayout person_sign = (LinearLayout) findViewById(R.id.person_sign);
            person_sign.setOnClickListener(this);
            LinearLayout person_footprint = (LinearLayout) findViewById(R.id.person_footprint);
            person_footprint.setOnClickListener(this);
            LinearLayout person_publish = (LinearLayout) findViewById(R.id.person_publish);
            person_publish.setOnClickListener(this);
            LinearLayout person_photowall = (LinearLayout) findViewById(R.id.person_photowall);
            person_photowall.setOnClickListener(this);
            LinearLayout person_lucky = (LinearLayout) findViewById(R.id.person_lucky);
            person_lucky.setOnClickListener(this);
            LinearLayout person_invite = (LinearLayout) findViewById(R.id.person_invite);
            person_invite.setOnClickListener(this);
            LinearLayout person_set = (LinearLayout) findViewById(R.id.person_set);
            person_set.setOnClickListener(this);
        }
    
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.person_sign:
                    //签到
                    LayoutInflater inflater = getLayoutInflater();
                    View layout = inflater.inflate(R.layout.activity_toast_signtoday, null);
                    Toast toast = new Toast(getApplicationContext());
                    toast.setGravity(Gravity.CENTER, 0, 0);
                    toast.setDuration(Toast.LENGTH_LONG);
                    toast.setView(layout);
                    toast.show();
                    break;
                case R.id.person_footprint:
                    //足迹
                    Toast.makeText(this,"足迹",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.person_publish:
                    //我发布的
                    Toast.makeText(this,"我发布的",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.person_photowall:
                    //照片墙
                    Toast.makeText(this,"照片墙",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.person_lucky:
                    //开始抽奖
                    Toast.makeText(this,"开始抽奖",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.person_invite:
                    //邀请奖励
                    Toast.makeText(this,"邀请奖励",Toast.LENGTH_SHORT).show();
                    break;
                case R.id.person_set:
                    //设置
                    Toast.makeText(this,"设置",Toast.LENGTH_SHORT).show();
                    break;
            }
        }
    }
    
    

    TranslucentScrollView.java

    package com.example.personview.widget;
    
    import android.animation.ObjectAnimator;
    import android.animation.ValueAnimator;
    import android.content.Context;
    import android.graphics.Color;
    import android.support.annotation.ColorInt;
    import android.support.v4.graphics.ColorUtils;
    import android.util.AttributeSet;
    import android.util.Log;
    import android.view.MotionEvent;
    import android.view.View;
    import android.view.ViewGroup;
    import android.view.WindowManager;
    import android.widget.ScrollView;
    
    import com.example.personview.R;
    import com.example.personview.utils.SizeUtils;
    
    /**
     * Created by 晓辉(xiaohui)
     * time:2019/8/13
     */
    
    public class TranslucentScrollView extends ScrollView {
    
        static final String TAG = "TranslucentScrollView";
    
        //伸缩视图
        private View zoomView;
        //伸缩视图初始高度
        private int zoomViewInitHeight = 0;
        // 记录首次按下位置
        private float mFirstPosition = 0;
        // 是否正在放大
        private Boolean mScaling = false;
    
        //渐变的视图
        private View transView;
        //渐变颜色
        private int transColor = Color.WHITE;
        //渐变开始位置
        private int transStartY = 50;
        //渐变结束位置
        private int transEndY = 300;
    
        //渐变开始默认位置,Y轴,50dp
        private final int DFT_TRANSSTARTY = 50;
        //渐变结束默认位置,Y轴,300dp
        private final int DFT_TRANSENDY = 300;
    
        private TranslucentScrollView.TranslucentChangedListener translucentChangedListener;
    
        public interface TranslucentChangedListener {
            /**
             * 透明度变化,取值范围0-255
             *
             * @param transAlpha
             */
            void onTranslucentChanged(int transAlpha);
        }
    
        public TranslucentScrollView(Context context) {
            super(context);
        }
    
        public TranslucentScrollView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public TranslucentScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
        public void setTranslucentChangedListener(TranslucentScrollView.TranslucentChangedListener translucentChangedListener) {
            this.translucentChangedListener = translucentChangedListener;
        }
    
        /**
         * 设置伸缩视图
         *
         * @param zoomView
         */
        public void setPullZoomView(View zoomView) {
            this.zoomView = zoomView;
            zoomViewInitHeight = zoomView.getLayoutParams().height;
            if (zoomViewInitHeight == LayoutParams.MATCH_PARENT || zoomViewInitHeight == WindowManager.LayoutParams.WRAP_CONTENT) {
                zoomView.post(new Runnable() {
                    @Override
                    public void run() {
                        zoomViewInitHeight = TranslucentScrollView.this.zoomView.getHeight();
                    }
                });
            }
        }
    
        /**
         * 设置渐变视图
         *
         * @param transView 渐变的视图
         */
        public void setTransView(View transView) {
            setTransView(transView, getResources().getColor(R.color.colorPrimary), SizeUtils.dip2px(getContext(), DFT_TRANSSTARTY), SizeUtils.dip2px(getContext(), DFT_TRANSENDY));
        }
    
        /**
         * 设置渐变视图
         *
         * @param transView  渐变的视图
         * @param transColor 渐变颜色
         * @param transEndY  渐变结束位置
         */
        public void setTransView(View transView, @ColorInt int transColor, int transStartY, int transEndY) {
            this.transView = transView;
            //初始视图-透明
            this.transView.setBackgroundColor(ColorUtils.setAlphaComponent(transColor, 0));
            this.transStartY = transStartY;
            this.transEndY = transEndY;
            this.transColor = transColor;
            if (transStartY > transEndY) {
                throw new IllegalArgumentException("transStartY 不得大于 transEndY .. ");
            }
        }
    
        /**
         * 获取透明度
         *
         * @return
         */
        private int getTransAlpha() {
            float scrollY = getScrollY();
            if (transStartY != 0) {
                if (scrollY <= transStartY) {
                    return 0;
                } else if (scrollY >= transEndY) {
                    return 255;
                } else {
                    return (int) ((scrollY - transStartY) / (transEndY - transStartY) * 255);
                }
            } else {
                if (scrollY >= transEndY) {
                    return 255;
                }
                return (int) ((transEndY - scrollY) / transEndY * 255);
            }
        }
    
        /**
         * 重置ZoomView
         */
        private void resetZoomView() {
            final ViewGroup.LayoutParams lp = zoomView.getLayoutParams();
            final float h = zoomView.getLayoutParams().height;// ZoomView当前高度
    
            // 设置动画
            ValueAnimator anim = ObjectAnimator.ofFloat(0.0F, 1.0F).setDuration(200);
    
            anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    float cVal = (Float) animation.getAnimatedValue();
                    lp.height = (int) (h - (h - zoomViewInitHeight) * cVal);
                    zoomView.setLayoutParams(lp);
                }
            });
            anim.start();
        }
    
        @Override
        protected void onScrollChanged(int l, int t, int oldl, int oldt) {
            super.onScrollChanged(l, t, oldl, oldt);
            int transAlpha = getTransAlpha();
    
            if (transView != null) {
                Log.d(TAG, "[onScrollChanged .. in ], 透明度 == " + transAlpha);
                transView.setBackgroundColor(ColorUtils.setAlphaComponent(transColor, transAlpha));
            }
            if (translucentChangedListener != null) {
                translucentChangedListener.onTranslucentChanged(transAlpha);
            }
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            if (zoomView != null) {
                ViewGroup.LayoutParams params = zoomView.getLayoutParams();
                switch (event.getAction()) {
                    case MotionEvent.ACTION_UP:
                        //手指离开后恢复图片
                        mScaling = false;
                        resetZoomView();
                        break;
                    case MotionEvent.ACTION_MOVE:
                        if (!mScaling) {
                            if (getScrollY() == 0) {
                                mFirstPosition = event.getY();
                            } else {
                                break;
                            }
                        }
    
                        int distance = (int) ((event.getY() - mFirstPosition) * 0.6);
                        if (distance < 0) {
                            break;
                        }
                        mScaling = true;
                        params.height = zoomViewInitHeight + distance;
    
                        Log.d(TAG, "params.height == " + params.height + ", zoomViewInitHeight == " + zoomViewInitHeight + ", distance == " + distance);
                        zoomView.setLayoutParams(params);
                        return true;
                }
            }
    
            return super.onTouchEvent(event);
        }
    
    }
    
    

    TranslucentActionBar.java

    package com.example.personview.widget;
    
    import android.content.Context;
    import android.text.TextUtils;
    import android.util.AttributeSet;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.LinearLayout;
    import android.widget.TextView;
    
    import com.example.personview.R;
    import com.example.personview.impl.ActionBarClickListener;
    
    /**
     * 支持渐变的 actionBar
     * Created by 晓辉(xiaohui)
     * time: 2019/8/13.
     */
    
    public final class TranslucentActionBar extends LinearLayout {
    
        private View layRoot;
        private View vStatusBar;
        private View layLeft;
        private View layRight;
        public TextView tvTitle;
        private TextView tvLeft;
        private TextView tvRight;
        private View iconLeft;
        private View iconRight;
    
        public TranslucentActionBar(Context context) {
            this(context, null);
        }
    
        public TranslucentActionBar(Context context, AttributeSet attrs) {
            super(context, attrs);
            init();
        }
    
        public TranslucentActionBar(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
        private void init() {
            setOrientation(HORIZONTAL);
            View contentView = inflate(getContext(), R.layout.actionbar_trans, this);
            layRoot = contentView.findViewById(R.id.lay_transroot);
            vStatusBar = contentView.findViewById(R.id.v_statusbar);
            tvTitle = (TextView) contentView.findViewById(R.id.tv_actionbar_title);
            tvLeft = (TextView) contentView.findViewById(R.id.tv_actionbar_left);
            tvRight = (TextView) contentView.findViewById(R.id.tv_actionbar_right);
            iconLeft = contentView.findViewById(R.id.iv_actionbar_left);
            iconRight = contentView.findViewById(R.id.v_actionbar_right);
        }
    
        /**
         * 设置状态栏高度
         *
         * @param statusBarHeight
         */
        public void setStatusBarHeight(int statusBarHeight) {
            ViewGroup.LayoutParams params = vStatusBar.getLayoutParams();
            params.height = statusBarHeight;
            vStatusBar.setLayoutParams(params);
        }
    
        /**
         * 设置是否需要渐变
         */
        public void setNeedTranslucent() {
            setNeedTranslucent(true, false);
        }
    
        /**
         * 设置是否需要渐变,并且隐藏标题
         *
         * @param translucent
         */
        public void setNeedTranslucent(boolean translucent, boolean titleInitVisibile) {
            if (translucent) {
                layRoot.setBackgroundDrawable(null);
            }
            if (!titleInitVisibile) {
                tvTitle.setVisibility(View.GONE);
            }
        }
    
        /**
         * 设置标题
         *
         * @param strTitle
         */
        public void setTitle(String strTitle) {
            if (!TextUtils.isEmpty(strTitle)) {
                tvTitle.setText(strTitle);
            } else {
                tvTitle.setVisibility(View.GONE);
            }
        }
    
        /**
         * 设置数据
         *
         * @param strTitle
         * @param resIdLeft
         * @param strLeft
         * @param resIdRight
         * @param strRight
         * @param listener
         */
        public void setData(String strTitle, int resIdLeft, String strLeft, int resIdRight, String strRight, final ActionBarClickListener listener) {
            if (!TextUtils.isEmpty(strTitle)) {
                tvTitle.setText(strTitle);
            } else {
                tvTitle.setVisibility(View.GONE);
            }
            if (!TextUtils.isEmpty(strLeft)) {
                tvLeft.setText(strLeft);
                tvLeft.setVisibility(View.VISIBLE);
            } else {
                tvLeft.setVisibility(View.GONE);
            }
            if (!TextUtils.isEmpty(strRight)) {
                tvRight.setText(strRight);
                tvRight.setVisibility(View.VISIBLE);
            } else {
                tvRight.setVisibility(View.GONE);
            }
    
            if (resIdLeft == 0) {
                iconLeft.setVisibility(View.GONE);
            } else {
                iconLeft.setBackgroundResource(resIdLeft);
                iconLeft.setVisibility(View.VISIBLE);
            }
    
            if (resIdRight == 0) {
                iconRight.setVisibility(View.GONE);
            } else {
                iconRight.setBackgroundResource(resIdRight);
                iconRight.setVisibility(View.VISIBLE);
            }
    
            if (listener != null) {
                layLeft = findViewById(R.id.lay_actionbar_left);
                layRight = findViewById(R.id.lay_actionbar_right);
                layLeft.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        listener.onLeftClick();
                    }
                });
                layRight.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        listener.onRightClick();
                    }
                });
            }
        }
    
    }
    
    

    布局文件:activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        xmlns:app="http://schemas.android.com/apk/res-auto">
        <com.example.personview.widget.TranslucentScrollView
            android:id="@+id/pullzoom_scrollview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                <LinearLayout
                    android:id="@+id/lay_header"
                    android:layout_width="match_parent"
                    android:layout_height="248dp"
                    android:background="@mipmap/bg_banner_my"
                    android:orientation="vertical">
                    <View
                        android:id="@+id/v_statusbar"
                        android:layout_width="match_parent"
                        android:layout_height="0.0dp"
                        android:background="@color/translate" />
                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">
                        <RelativeLayout
                            android:layout_width="137dp"
                            android:layout_height="137dp"
                            android:layout_centerInParent="true"
                            android:background="@mipmap/bg_avatar">
                            <de.hdodenhof.circleimageview.CircleImageView
                                android:id="@+id/image_head"
                                android:layout_width="105dp"
                                android:layout_height="105dp"
                                android:layout_centerInParent="true"
                                android:src="@mipmap/dft_avatar"
                                app:civ_border_color="#FFFFFF"
                                app:civ_border_width="1dp" />
                        </RelativeLayout>
                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentBottom="true"
                            android:layout_centerHorizontal="true"
                            android:layout_marginBottom="15dp"
                            android:orientation="vertical">
                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:gravity="center">
                            <TextView
                                android:id="@+id/name"
                                style="@style/text_white"
                                android:layout_gravity="center_horizontal"
                                android:text="@string/name"
                                android:textColor="@color/white"
                                android:textSize="17sp" />
                        </LinearLayout>
                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:gravity="center">
                                <TextView
                                    android:id="@+id/frag4_age"
                                    android:layout_width="30dp"
                                    android:layout_height="22dp"
                                    android:background="@drawable/bg_person_left"
                                    android:gravity="center_horizontal"
                                    android:text="20"
                                    android:textSize="11sp" />
    
                                <ImageView
                                 android:id="@+id/frag4_sex"
                                 android:layout_width="30dp"
                                 android:layout_height="22dp"
                                 android:paddingRight="6dp"
                                 android:paddingTop="4dp"
                                 android:paddingBottom="2dp"
                                 android:background="@drawable/bg_person_right"
                                 android:src="@drawable/ic_person_man" />
                            </LinearLayout>
                        </LinearLayout>
                    </RelativeLayout>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    android:orientation="horizontal"
                    android:paddingTop="8dp"
                    android:paddingBottom="8dp">
                    <LinearLayout
                        android:id="@+id/lay_car"
                        android:layout_width="0.0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1.0"
                        android:gravity="center_horizontal"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="50dp"
                            android:layout_height="50dp"
                            android:scaleType="fitXY"
                            android:src="@mipmap/ic_shopcar_my" />
                        <TextView
                            style="@style/text_black"
                            android:layout_marginTop="5dp"
                            android:text="@string/contribute" />
                        <TextView
                            style="@style/text_black"
                            android:id="@+id/contribute"
                            android:layout_marginTop="5dp"
                            android:text="1000+" />
                    </LinearLayout>
                    <LinearLayout
                        android:id="@+id/lay_history"
                        android:layout_width="0.0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1.0"
                        android:gravity="center_horizontal"
                        android:orientation="vertical">
                        <ImageView
                            android:id="@+id/imageView"
                            android:layout_width="50dp"
                            android:layout_height="50dp"
                            android:scaleType="fitXY"
                            android:src="@mipmap/ic_consume_history" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_marginTop="5dp"
                            android:text="@string/grade" />
                        <TextView
                            style="@style/text_black"
                            android:id="@+id/grade"
                            android:layout_width="wrap_content"
                            android:layout_marginTop="5dp"
                            android:text="V10" />
                    </LinearLayout>
                    <LinearLayout
                        android:id="@+id/lay_wallet"
                        android:layout_width="0.0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1.0"
                        android:gravity="center_horizontal"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="50dp"
                            android:layout_height="50dp"
                            android:scaleType="fitXY"
                            android:src="@mipmap/ic_wallet" />
                        <TextView
                            style="@style/text_black"
                            android:layout_marginTop="5dp"
                            android:text="@string/coin" />
                        <TextView
                            style="@style/text_black"
                            android:id="@+id/coin"
                            android:layout_marginTop="5dp"
                            android:text="500" />
                    </LinearLayout>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    android:orientation="vertical">
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="15dp"
                        android:background="@color/bg_main" />
                    <LinearLayout
                        android:id="@+id/person_sign"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_sign" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:text="@string/sign" />
                        <TextView
                            android:id="@+id/tv_has_sign"
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="3dp"
                            android:layout_weight="1"
                            android:text="@string/sign"
                            android:textColor="@color/gray_dft"
                            android:textSize="13sp"
                            android:visibility="invisible" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        style="@style/horizontal_divider_light"
                        android:layout_marginLeft="16dp" />
                    <LinearLayout
                        android:id="@+id/person_footprint"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_address" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:layout_weight="1"
                            android:text="@string/footprint" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="15dp"
                        android:background="@color/bg_main" />
                    <LinearLayout
                        android:id="@+id/person_publish"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_agent_my" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:layout_weight="1"
                            android:text="@string/publish" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        style="@style/horizontal_divider_light"
                        android:layout_marginLeft="16dp" />
                    <LinearLayout
                        android:id="@+id/person_photowall"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_teacher_my" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:layout_weight="1"
                            android:text="@string/photowall" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="15dp"
                        android:background="@color/bg_main" />
                    <LinearLayout
                        android:id="@+id/person_lucky"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_luck_my" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:layout_weight="1"
                            android:text="@string/lucky" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        style="@style/horizontal_divider_light"
                        android:layout_marginLeft="16dp" />
                    <LinearLayout
                        android:id="@+id/person_invite"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_invite_my" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:layout_weight="1"
                            android:text="@string/invite" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="15dp"
                        android:background="@color/bg_main" />
                    <LinearLayout
                        android:id="@+id/person_set"
                        android:layout_width="match_parent"
                        android:layout_height="55dp"
                        android:background="@color/white"
                        android:orientation="horizontal">
                        <ImageView
                            android:layout_width="15dp"
                            android:layout_height="15dp"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="16dp"
                            android:background="@mipmap/ic_set_my" />
                        <TextView
                            style="@style/text_black"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="17dp"
                            android:layout_weight="1"
                            android:text="@string/set" />
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginRight="16dp"
                            android:background="@mipmap/ic_right_gray" />
                    </LinearLayout>
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="140dp"
                        android:background="@color/bg_main" />
                </LinearLayout>
            </LinearLayout>
        </com.example.personview.widget.TranslucentScrollView>
        <com.example.personview.widget.TranslucentActionBar
            android:id="@+id/actionbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>
    

    activity_actionbar.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        <com.example.personview.widget.TranslucentActionBar
            android:id="@+id/actionbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    
        <com.example.personview.widget.TranslucentScrollView
            android:id="@+id/scrollview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="1000dp"
                android:orientation="vertical" />
        </com.example.personview.widget.TranslucentScrollView>
    </LinearLayout>
    

    actionbar_trans.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/lay_transroot"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary"
        android:orientation="vertical">
        <View
            android:id="@+id/v_statusbar"
            android:layout_width="match_parent"
            android:layout_height="1.0dp" />
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="45dp"
            android:orientation="vertical">
            <RelativeLayout
                android:id="@+id/lay_actionbar_left"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:orientation="horizontal">
                <ImageView
                    android:id="@+id/iv_actionbar_left"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="10dp"
                    android:background="@mipmap/ic_left_light"
                    android:visibility="gone" />
                <TextView
                    android:id="@+id/tv_actionbar_left"
                    style="@style/text_white"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="10dp"
                    android:layout_toRightOf="@+id/iv_actionbar_left"
                    android:gravity="center_vertical"
                    android:maxLength="2"
                    android:singleLine="true"
                    android:text="返回"
                    android:visibility="gone" />
            </RelativeLayout>
            <TextView
                android:id="@+id/tv_actionbar_title"
                style="@style/text_white"
                android:layout_centerInParent="true"
                android:text="标题"
                android:textSize="16sp" />
            <RelativeLayout
                android:id="@+id/lay_actionbar_right"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:layout_alignParentRight="true"
                android:gravity="right"
                android:orientation="horizontal">
                <View
                    android:id="@+id/v_actionbar_right"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:layout_marginRight="10dp"
                    android:visibility="gone" />
                <TextView
                    android:id="@+id/tv_actionbar_right"
                    style="@style/text_white"
                    android:layout_height="match_parent"
                    android:layout_marginRight="10dp"
                    android:layout_toLeftOf="@+id/v_actionbar_right"
                    android:gravity="center_vertical|right"
                    android:singleLine="true"
                    android:visibility="gone" />
            </RelativeLayout>
        </RelativeLayout>
    </LinearLayout>
    

    注意:全面屏要使标题栏渐变,除了需要在mainActivity.java里声明外,还要在AndroidManifest.xml中将theme设置成为android:theme="@style/TranslucentTheme";并且引入三个style样式文件,适应不同的机型。
    在这里插入图片描述
    好了核心代码就是这些,如下有项目完整包

    下载地址:https://download.csdn.net/download/qq_41894451/11538983

    展开全文
  • 自定义ScrollView实现Toolbar(标题栏)渐变效果如: 编程思想:1、自定义一个类,继承自ScrollView,并重写它的 onScrollChanged 方法;2、在 onScrollChanged 中获取 ScrollView 在Y轴的移动距离,并根据此距离...
  • 设置导航栏背景图 标题颜色
  • 小程序顶部标题栏背景图片设置

    千次阅读 2019-12-03 10:08:06
    实际运行结果为: 实现步骤 知识点讲解: 修改 navigationStyle 字段,关于这个属性,以下是官方解释: 在uniapp中 ...修改导航为自定义导航样式 修改需要配背景图片的页面路由的属性值,此...
  • 标题栏修改背景色或背景图

    千次阅读 2012-09-20 17:11:11
    //标题栏修改 void DrawTitleBar(CDC *pDC); LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); void ShowBitmap(CDC *pDC, int x, int y, int nW, int nH, CBitmap &m_bitmap);
  • 先上ListView滑动改变标题栏背景渐变效果,透明转变成不透明效果: 1: 2: 3: 4: 我用的是小米Note手机,状态栏高度是55px,后面会提到,这里先做个说明: 下面的内容包含了所有代码...
  • 以图片为背景标题栏
  • 主要介绍了Android编程中聊天页面背景图片、标题栏由于键盘引起问题的解决方法,针对键盘弹出时标题栏背景图片异常的相关解决方法,具有一定参考借鉴价值,需要的朋友可以参考下
  • android标题栏背景颜色

    2012-12-17 09:35:26
    1. 设置标题栏背景 1> 准备背景图片: background_pix.png 注:用背景图片比用颜色好处,可以让背景看起来有凹凸感. 2> drawable文件夹下放xml文件 bitmap_repeat.xml ... android:src="@drawable/back
  • 首先将styles文件的AppTheme改为无标题栏 即: <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 一、Android 1.状态栏背景图片的延伸:首先设置实现方法 fullScreen() /** * ...
  • 技巧_MFC_标题栏背景

    千次阅读 2012-11-21 16:17:29
    需要在标题栏上贴图,更换标题栏背景的时候,不想要标题栏显示颜色,尤其拉动改变窗体大小的时候,所以需要禁止标题栏重绘的方法。 只需要 处理WM_NCPAINT消息就好了,消息处理函数OnNcPaint中去掉CDialog::...
  • ScrollView中添加ListView,标题栏划动隐藏,拉动listView头部背景图片实现刷新
  • 需要在标题栏上贴图,更换标题栏背景的时候,不想要标题栏显示颜色,尤其拉动改变窗体大小的时候,所以需要禁止标题栏重绘的方法。 只需要 处理WM_NCPAINT消息就好了,消息处理函数OnNcPaint中去掉CDialog::...
  • 自己继承QDialog 自定义了一个Dialog类,要给它添加一个新的Tittle的背景图片,怎么弄??
  • mfc重绘标题栏

    2018-03-21 22:55:59
    mfc重绘标题栏,更换标题栏背景图像,颜色,添加按钮,更换标题栏标题样式
  • 通常对导航的要求是:背景颜色,左右按钮颜色,标题字体颜色及大小。 再多一点要求:设置图片导航,设置导航渐变 还有一点就是去除导航下的一条细线 设置背景颜色: self.navigationController....
  • 说起对UI的更改,很多时候我们只是修改一下原有UI的背景啊,颜色之类的,以达到新的要求。  在此之前呢,设置UINavigationController的背景颜色,我会使用如下的代码: 首先看.h文件 [plain] view ...
  • QT隐藏标题栏背景

    2020-11-24 13:37:11
    如下,加载日志的时候显示一个加载进度,这个时候需要隐藏背景,和标题框,可以使用一下两句代码 ...//隐藏标题栏,去除任务栏 setAttribute(Qt::WA_TranslucentBackground);//镂空背景 ...
  • 但是,我只是想改变标题栏字体的大小、颜色,并设置一个背景图片,并不想定义一个layout的xml文件。那么,android有没有提供解决上述问题的方法呢,答案是肯定的,一定可以。默认的标题栏式样太难看了,灰不啦吉的。...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,131
精华内容 452
关键字:

标题栏背景图