Code Monkey home page Code Monkey logo

floatactionview's Introduction

简要说明

一个使用adapter和clickListener模式的Float Action Button

使用简单,自己继承基础Adapter实现各样的Fab。

自带一个仿Evernote的fab。

image

使用方法

首先添加FloatActionView。你给他多大空间。他就在多大空间里伸缩。并靠右下对齐。

<com.jude.view.FloatActionView
    android:id="@+id/fab"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    
</com.jude.view.FloatActionView>

给它设置适配器

fab = (FloatActionView) findViewById(R.id.fab);
fab.setAdapter(new MyFloatViewAdapter(this));

适配器代码

class MyFloatViewAdapter extends HintFloatViewAdapter{

	public MyFloatViewAdapter(Context ctx) {
		super(ctx);
	}

	@Override
	public int getCount() {
		return 5;
	}

	@Override
	public int getMainDrawableResource() {
		return R.drawable.fab_plus_00bcd4;
	}

	@Override
	public int getItemDrawableResource(int position) {	
		return R.drawable.fab_commonmap_00bcd4+position;
	}

	@Override
	public String getItemHint(int position) {
		return "提示文本";
	}
}

这样就好了。可以自己继承FloatViewAdapter以实现更多样式

floatactionview's People

Contributors

jude95 avatar

Watchers

 avatar  avatar  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.