GithubHelp home page GithubHelp logo

advancedtextswitcher's Introduction

AdvancedTextSwitcher

Advanced TextSwitcher for faster development.

Just like the way how Google+ display recent reviews on their cards.

仿照Google+在卡片上滚动显示最新评论的TextSwitcher。

Preview 预览

Snapshot

Watch Preview on Youtube

Add to your project 添加到你的项目

Add JitPack repository to build.gradle in project root.

在项目根目录下的build.gradle中加入以下内容

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Add the dependency to build.gradle in app root.

在应用目录下的build.gradle中加入以下依赖

dependencies {
        compile 'com.github.SumiMakito:AdvancedTextSwitcher:0.3'
}

You can also add this project as a library to your project directly.(NOT recommended)

Usage 使用说明

Import 导入
import sumimakito.android.advtextswitcher.*;
Add Widget in XML 在XML中加入控件
<sumimakito.android.advtextswitcher.AdvTextSwitcher
		xmlns:app="http://schemas.android.com/apk/res/sumimakito.android.advtextswitcher"
		android:id="@+id/advTextSwitcher"
		android:textColor="#66BCBB"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		app:textSize="32sp"
		app:gravity="center"
		app:inAnim="@android:anim/slide_in_left"
		app:outAnim="@android:anim/slide_out_right" />
Attributes 属性
  • xmlns:app (Don't forget to copy the xmlns:app line.)
  • android:textColor Text color.
  • app:textSize Text size.
  • app:gravity Gravity for each text.(Only support center/left/right, CENTER_VERTICAL is automatically applied.)
  • app:inAnim/outAnim (Optional) Specify anim resources.
Attach AdvTextSwitcher in Java 在Java代码中调用
    //For example, the String array below contains four recent reviews.
    String[] texts = {"Anne: Great!", "Cathy: I do not think so.", "Jimmy: Cloning your repo...", "Aoi: This bug disappeared!"};
    advTextSwitcher = (AdvTextSwitcher) findViewById(R.id.advTextSwitcher);
    //Give them to AdvTextSwitcher
    advTextSwitcher.setTexts(texts);
    //Manually switch to the next text in the String array.
    advTextSwitcher.next();
    //Switch to the previous one.
    advTextSwitcher.previous();

    //Auto switch between texts every 5000ms.
    Switcher switcher = new Switcher(advTextSwitcher, 5000);
    switcher.start();
    //Pause
    switcher.pause();
    //Or use switcher in only one line...
    new Switcher().attach(advTextSwitcher).setDuration(5000).start();

    //Want to know which text is clicked?
    advTextSwitcher.setCallback(new AdvTextSwitcher.Callback(){
			    	@Override
		    		public void onItemClick(int position)
	    			{
		    		    Toast.makeText(MainActivity.this, "ITEM@"+position+" Clicked!", Toast.LENGTH_SHORT).show();
		    		}
    });

Donate & Support 捐赠与支持

Makito是一个自由的软件开发者,也是一名在校大学生。

欢迎您去查看我的其他开源项目,同时也欢迎通过打赏支持我一下。感谢

支付宝/AliPay

826257232#qq.com (#请换成@)

微信支付

PayPal

sumimakito#hotmail.com (replace # with @)

Copyright & License 版权信息与授权协议

Copyright © 2014-2015 Sumi Makito

Licensed under Apache License 2.0 License.

Copyright 2014-2015 Sumi Makito

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.

advancedtextswitcher's People

Contributors

sumimakito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

advancedtextswitcher's Issues

Please add a snapshot

you make AdvancedTextSwitcher, and it is a view ,so if show a pic on readme file ,the reader will understand you AdvancedTextSwitcher easily

build.gradle无法导入

不管是compile 'com.github.SumiMakito:AdvancedTextSwitcher:0.1'或者compile 'com.github.SumiMakito:AdvancedTextSwitcher:2.10'都无法导入,无法用呀

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.