当前位置: 搜索的结果

自定义控件StepView

本例子主要包括HorizontalStepView,VerticalStepView效果图分别如下,
其中水平实现:
 <com.baoyachi.stepview.HorizontalStepView
            android:id="@+id/step_view0"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textColor="@android:color/white"
            android:textSize="14sp"
            />

主要代码如下:
HorizontalStepView setpview0 = (HorizontalStepView) mView.findViewById(R.id.step_view0);
        List<String> list0 = new ArrayList<>();
        list0.add("接单");
        list0.add("打包");
        list0.add("出发");
        list0.add("送单");
        list0.add("完成");
        list0.add("支付");
        setpview0.setStepsViewIndicatorComplectingPosition(2)//设置完成的步数
                .setStepViewTexts(list0)//总步骤
                .setStepsViewIndicatorCompletedLineColor(ContextCompat.getColor(getActivity(), android.R.color.white))//设置StepsViewIndicator完成线的颜色
                .setStepsViewIndicatorUnCompletedLineColor(ContextCompat.getColor(getActivity(), R.color.uncompleted_text_color))//设置StepsViewIndicator未完成线的颜色
                .setStepViewComplectedTextColor(ContextCompat.getColor(getActivity(), android.R.color.white))//设置StepsView text完成线的颜色
                .setStepViewUnComplectedTextColor(ContextCompat.getColor(getActivity(), R.color.uncompleted_text_color))//设置StepsView text未完成线的颜色
                .setStepsViewIndicatorCompleteIcon(ContextCompat.getDrawable(getActivity(), R.drawable.complted))//设置StepsViewIndicator CompleteIcon
                .setStepsViewIndicatorDefaultIcon(ContextCompat.getDrawable(getActivity(), R.drawable.default_icon))//设置StepsViewIndicator DefaultIcon
                .setStepsViewIndicatorAttentionIcon(ContextCompat.getDrawable(getActivity(), R.drawable.attention));//设置StepsViewIndicator AttentionIcon

 


 本例子主要
自定义控件的加强
Canvas,Paint的使用,如何绘制矩形,如何绘制虚线,如何绘制圆,加上小小的数学计算
项目来源:
https://github.com/baoyachi/StepView

3d旋转切换view,类似旋转木马效果

3d旋转切换view,类似旋转木马效果。可以自动切换!
1: LoopRotarySwitchView 可以无限循环,自动旋转,停靠的3D旋转布局控件,无需编写代码,直接在布局中加入自己的布局即可。 控件继承相对布局RelativeLayout直接可以当做布局使用。

来自:https://github.com/dalong982242260/SlidingBall
优势

*1.3d旋转RelativeLayout
*2.支持自动旋转
*3.可直接在xml添加元素即可添加列数据。也可以动态代码添加view
*4.优良的兼容性,和可以自己尺寸控制
*5.添加了点击切换和点击中间监听,适合目前app的需求
*6.优化控件点击切换效果,使用更加的方法实用

 

android通过ScratchTextView 实现刮奖功能

android通过ScratchTextView 实现刮奖功能, 项目来自:https://github.com/cooltechworks/ScratchView
使用如下:进入布局
ScratchImageView
 
<com.cooltechworks.views.ScratchImageView
  android:id="@+id/sample_image"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:background="@android:color/white"
  android:src="@drawable/img_sample2"
  />


代码部分:

ScratchImageView scratchImageView = new ScratchImageView(this);

scratchImageView.setRevealListener(new ScratchImageView.IRevealListener() {
    @Override
    public void onRevealed(ScratchImageView tv) {
        // on reveal
    }
});

功能强大的StickyHeaderListView

功能强大的StickyHeaderListView:标题渐变、吸附悬停、筛选分类、动态头部等

来自:https://github.com/sfsheng0322/StickyHeaderListView

ImageView使用效果

ImageView使用效果,来自https://github.com/dinuscxj/LoadingDrawable

 ImageView.setImageDrawable(new LoadingDrawable(new SwapLoadingRenderer(Context)));
 ImageView.setImageDrawable(new LoadingDrawable(new GearLoadingRenderer(Context)));
 ImageView.setImageDrawable(new LoadingDrawable(new WhorlLoadingRenderer(Context)));
 ImageView.setImageDrawable(new LoadingDrawable(new LevelLoadingRenderer(Context)));
 ImageView.setImageDrawable(new LoadingDrawable(new MaterialLoadingRenderer(Context)));
 ImageView.setImageDrawable(new LoadingDrawable(new CollisionLoadingRenderer(Context)));

Used with View

 View.setBackground(new LoadingDrawable(new SwapLoadingRenderer(Context)));
 View.setBackground(new LoadingDrawable(new GearLoadingRenderer(Context)));
 View.setBackground(new LoadingDrawable(new WhorlLoadingRenderer(Context)));
 View.setBackground(new LoadingDrawable(new LevelLoadingRenderer(Context)));
 View.setBackground(new LoadingDrawable(new MaterialLoadingRenderer(Context)));
 View.setBackground(new LoadingDrawable(new CollisionLoadingRenderer(Context)));

MatchTextView实现加载效果

MatchTextView实现加载效果  来自:https://github.com/Rogero0o/MatchView
<com.roger.match.library.MatchTextView
        match:text="MATCH VIEW"
        match:textSize="30sp"
        match:textColor="#ffffff"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

<com.roger.match.library.MatchButton
        match:text="Yes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Or config in java code

// the following are default settings
 mMatchTextView.setText("MATCH VIEW");
 mMatchTextView.setTextSize(30);
 mMatchTextView.setTextColor(Color.WHITE);
// setProgress  float 0-1
 mMatchTextView.setProgress(0.5f);

 

 

CatLoadingView 实现漂亮的加载效果

CatLoadingView 实现漂亮的加载效果,项目来自https://github.com/Rogero0o/CatLoadingView

CatLoadingView mView;


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

    mView = new CatLoadingView();
    findViewById(R.id.button).setOnClickListener(
            new View.OnClickListener() {
                @Override public void onClick(View v) {
                    mView.show(getSupportFragmentManager(), "");
                }
            });
}

一个炫酷的SearchView搜索动画库

一个炫酷的SearchView搜索动画库 ,来自:https://github.com/android-cjj/JJSearchViewAnim
引入布局:
<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="com.cjj.jjsearchviewanim.MainActivity">

   
 </RelativeLayout>

代码调用:
   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        JJSearchView mJJSearchView = (JJSearchView) findViewById(R.id.jjsv);
        mJJSearchView.setController(new JJChangeArrowController());
    }

点击动画开始:
mJJSearchView.startAnim();
mJJSearchView.resetAnim();

UniversalVideoView视频播放

UniversalVideoView视频播放初次接触视频的朋友学习,本项目来自https://github.com/linsea/UniversalVideoView

listview下拉刷新仿最新版美团外卖

/** * 初始化view * * @param context */ private void init(Context context) { setOverScrollMode(View.OVER_SCROLL_NEVER); setOnScrollListener(this); headerView = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.listview_head_view, null, false); footerView = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.listview_foot_view, null, false); tv_load = (TextView) footerView.findViewById(R.id.tv_load); bg_view= (RefreshBgView) headerView.findViewById(R.id.bg_view); bg_view.setBackgroundResource(R.drawable.loading_bg1); bg_viewAnimation = (AnimationDrawable) bg_view.getBackground(); bg_viewAnimation.start(); refreshAnimView = (RefreshAnimView) headerView.findViewById(R.id.first_step_view); refreshLoadingView= (RefreshLoadingView) headerView.findViewById(R.id.second_step_view); refreshLoadingView.setBackgroundResource(R.drawable.anim_refresh); loadAnimation = (AnimationDrawable) refreshLoadingView.getBackground(); measureView(headerView); measureView(footerView); addHeaderView(headerView); addFooterView(footerView); headerViewHeight = headerView.getMeasuredHeight(); footerViewHeight = footerView.getMeasuredHeight(); headerView.setPadding(0, -headerViewHeight, 0, 0); footerView.setPadding(0, 0, 0, -footerViewHeight); refreshstate = REFRESH_DONE; loadstate = LOAD_DONE; isRefreshable = true; isLoadable = true; }