Giter Site home page Giter Site logo

supertooltips's Introduction

SuperToolTips (Play Store Demo)

SuperToolTips is an Open Source Android library that allows developers to easily create Tool Tips for views, from API 8 and on. Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.

Note

Version 2.0 brought some changes with it. The package name has changed to com.haarman.supertooltips, and the ToolTipFrameLayout has been renamed to ToolTipRelativeLayout. Please modify your own code to suit these changes.

Setup

  • In Eclipse, just import the library as an Android library project.
  • Project > Clean to generate the binaries you need, like R.java, etc.
  • Then, just add SuperToolTips as a dependency to your existing project and you're good to go!

Usage

  • In your layout xml file, add the ToolTipRelativeLayout (com.haarman.supertooltips.ToolTipRelativeLayout) with height and width of match_parent. Make sure this view is on top!
  • Find the ToolTipRelativeLayout in your code, and start adding ToolTips!

Example:

<RelativeLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"	
	tools:context=".MainActivity">

	<!-- Rest of Layout -->

	<com.haarman.supertooltips.ToolTipRelativeLayout
		android:id="@+id/activity_main_tooltipRelativeLayout"
		android:layout_width="match_parent"
		android:layout_height="match_parent" />
</RelativeLayout>

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ToolTipRelativeLayout toolTipRelativeLayout = (ToolTipRelativeLayout) findViewById(R.id.activity_main_tooltipRelativeLayout);
	
	myToolTipView = toolTipRelativeLayout.showToolTipForView(
            new ToolTip()
                    .withText("A beautiful View")
                    .withColor(Color.RED)
                    .withShadow(true)
					.withAnimationType(ToolTip.ANIMATIONTYPE_FROMTOP),
            findViewById(R.id.activity_main_redtv));
    myToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
}

ToolTip customization

You can customize the ToolTip in several ways:

  • Specify a content text using ToolTip.setText().
  • Set a color using ToolTip.setColor().
  • Specify whether to show a shadow or not with ToolTip.setShadow().
  • Specify how to animate the ToolTip: from the view itself or from the top, using ToolTip.setAnimationType().
  • Set your own custom content View using ToolTip.setContentView().

See the examples.

ActionBar

Currently, the dev branch contains methods for showing ToolTipViews for ActionBar items. Please note that this is entirely experimental and may only work for the original ActionBar.

Developed By

  • Niek Haarman

License

Copyright 2013 Niek Haarman

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

supertooltips's People

Contributors

nhaarman avatar alinoaimi avatar

Watchers

Sudarshan Rao avatar

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.