Git Product home page Git Product logo

tipview's Introduction

TipView

基于android-target-tooltip修改的---新功能提示view(可自定义提示样式) ####参考代码:https://github.com/sephiroth74/android-target-tooltip

只是基于这个代码改了一点,满足自己的需求

###ScreenShots

image

备注:

  • 1.原来的代码本身也是支持用户自定义提示样式的withCustomView(R.layout.custom_view),但是这个方法设置以后,就没有“箭头了”,具体效果看截图;
  • 2.源代码各个java代码实现的功能:

1.TooltipOverlay、TooltipOverlayDrawable 是用来实现目标view上的点击效果,在我这个项目中暂时没有用到;

2.TooltipTextDrawable 实现背景---就是带有小箭头、圆角之类的背景,非常重要(核心就是代码画背景);

3.Tooltip 实现“提示view”的构建,展示,关闭,等等

  • 3.主要修改的代码段落:

Tooltip initializeView()方法中

if (null != mDrawable) {
    mTextView.setBackgroundDrawable(mDrawable);
if (mHideArrow) {
    mTextView.setPadding(mPadding / 2, mPadding / 2, mPadding / 2, mPadding / 2);
} else {
    mTextView.setPadding(mPadding, mPadding, mPadding, mPadding);
    }
}

这段代码中,mDrawable就是TooltipTextDrawable,指绘制的背景,所以只需要将mTextView改成我们需要的view就可以了,修改后:

if (null != mDrawable) {
    mLayout.setBackgroundDrawable(mDrawable);
if (mHideArrow) {
    mLayout.setPadding(mPadding / 2, mPadding / 2, mPadding / 2, mPadding / 2);
} else {
    mLayout.setPadding(mPadding, mPadding, mPadding, mPadding);
    }
}

其中mLayout就是我们自定义的样式,写在tooltip_view.xml中

mTextView = (TextView) mView.findViewById(android.R.id.text1);
mLbDismiss = (TextView) mView.findViewById(R.id.lbDismiss);
mLayout = (LinearLayout) mView.findViewById(R.id.layout);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.