android.app.TimePickerDialog.OnTimeSetListener#android.support.design.widget.FloatingActionButton源码实例Demo

下面列出了android.app.TimePickerDialog.OnTimeSetListener#android.support.design.widget.FloatingActionButton 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@SuppressLint("RestrictedApi")
private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);

    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F)
                .setInterpolator(INTERPOLATOR).withLayer().setListener(null)
                .start();

    }
    else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);

    }
}
 
源代码2 项目: actor-platform   文件: ComposeFabFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View res = inflater.inflate(R.layout.fragment_fab, container, false);
    FloatingActionButton fabRoot = (FloatingActionButton) res.findViewById(R.id.fab);
    fabRoot.setImageResource(R.drawable.ic_edit_white_24dp);
    fabRoot.setBackgroundTintList(new ColorStateList(new int[][]{
            new int[]{android.R.attr.state_pressed},
            StateSet.WILD_CARD,

    }, new int[]{
            ActorSDK.sharedActor().style.getFabPressedColor(),
            ActorSDK.sharedActor().style.getFabColor(),
    }));
    fabRoot.setRippleColor(ActorSDK.sharedActor().style.getFabPressedColor());
    fabRoot.setOnClickListener(v -> startActivity(new Intent(getActivity(), ComposeActivity.class)));
    return res;
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}
 
源代码4 项目: Material-Color-Picker   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final Context ctx = this;
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View view) {
            ColorChooserDialog dialog = new ColorChooserDialog(ctx);
            dialog.setColorListener(new ColorListener() {
                @Override
                public void OnColorClick(View v, int color) {
                    Snackbar.make(view, "Color: "+color, Snackbar.LENGTH_LONG)
                            .setAction("Action", null).show();
                }
            });
            dialog.show();
        }
    });
}
 
源代码5 项目: materialup   文件: CreateActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create);

    ButterKnife.bind(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            fabClick(view);
        }
    });
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
源代码6 项目: TwoStageRate   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    initTwoStage();

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(new Intent(MainActivity.this, EventActivity.class));
        }
    });
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fan_menu_buttons1);
    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.myFAB);
    final FanMenuButtons sub = (FanMenuButtons) findViewById(R.id.myFABSubmenu);
    if (sub != null) {
        sub.setOnFanButtonClickListener(new FanMenuButtons.OnFanClickListener() {
            @Override
            public void onFanButtonClicked(int index) {
                Toast.makeText(FanMenuButtons1Activity.this, "Button Clicked = " + index, Toast.LENGTH_SHORT).show();
                //sub.setButtonSelected(index);
            }
        });

        if (fab != null) {
            fab.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    sub.toggleShow();
                }
            });
        }
    }
}
 
源代码8 项目: mobius-android-sample   文件: TasksFragment.java
@Nullable
@Override
public View onCreateView(
    LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

  FloatingActionButton fab = getActivity().findViewById(R.id.fab_add_task);
  mViews = new TasksViews(inflater, container, fab, mMenuEvents);

  mController =
      TasksInjector.createController(
          createEffectHandler(getContext(), mViews, this::showAddTask, this::showTaskDetailsUi),
          mEventSource,
          resolveDefaultModel(savedInstanceState));

  mController.connect(contramap(TasksListViewDataMapper::tasksListModelToViewData, mViews));
  setHasOptionsMenu(true);
  return mViews.getRootView();
}
 
源代码9 项目: Musicoco   文件: SongDetailActivity.java
private void initViews() {

        container = findViewById(R.id.song_detail_container);

        mClose = (ImageButton) findViewById(R.id.song_detail_close);
        mSaveImage = (FloatingActionButton) findViewById(R.id.song_detail_save_image);

        mImage = (ImageView) findViewById(R.id.song_detail_image);
        mName = (TextView) findViewById(R.id.song_detail_name);
        mArts = (TextView) findViewById(R.id.song_detail_arts);
        mLine = findViewById(R.id.song_detail_ni_line);
        mInfos = (TextView) findViewById(R.id.song_detail_infos);

        mImage.setOnClickListener(this);
        mClose.setOnClickListener(this);
        mSaveImage.setOnClickListener(this);

    }
 
源代码10 项目: RxBus   文件: MainActivity.java
/**
 * Init view and bus provider.
 *
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Mouse mouse = mouseMam.birth();
            mouse.squeak();
            Snackbar.make(view, "Birth a mouse and squeak ! " + mouse, Snackbar.LENGTH_SHORT)
                    .setAction("Action", null).show();
            Timber.e("Haha, i am " + mouse);
        }
    });

    RxBus.get().register(mouseMam);
    RxBus.get().register(catMam.birth());

    Timber.e("Moust Mam has registed? " + RxBus.get().hasRegistered(mouseMam));
}
 
源代码11 项目: MarkdownEditors   文件: ScrollAwareFABBehavior.java
private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button)
                .scaleX(1.0F)
                .scaleY(1.0F)
                .alpha(1.0F)
                .setInterpolator(INTERPOLATOR)
                .withLayer()
                .setListener(null)
                .start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(),
                android.support.design.R.anim.design_fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}
 
源代码12 项目: ESSocialSDK   文件: SsoAllActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sso_all);
    ButterKnife.bind(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    /**************************************************/
    BusProvider.getInstance().register(this);
    /**************************************************/
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    Boolean switchPref = sharedPref.getBoolean(SettingsActivity.KEY_PREF_EXAMPLE_SWITCH, false);
    Toast.makeText(this, switchPref.toString(), Toast.LENGTH_SHORT).show();
}
 
源代码14 项目: RxFile   文件: MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  Toolbar toolbar = findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);

  mBitmap = findViewById(R.id.iv_bitmap);

  RxFile.setLoggingEnabled(true);

  FloatingActionButton fab = findViewById(R.id.fab);
  fab.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
      pickFile();
    }
  });
}
 
源代码15 项目: text-scanner   文件: CropAndRotate.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crop_and_rotate);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ViewCompat.setElevation(toolbar,10);
    toolbar.setOnMenuItemClickListener(this);
    Intent intent = getIntent();
    message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    cropImageView = (CropImageView) findViewById(R.id.cropImageView);

    cropImageView.setImageUriAsync(Uri.parse(message));
    mFab = (FloatingActionButton) findViewById(R.id.nextStep);
    mFab.setOnClickListener(this);

}
 
源代码16 项目: MeiZiNews   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wd_ad);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
}
 
源代码17 项目: Study_Android_Demo   文件: ActivtyA.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_activty);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RecyclerView recyclerView = findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(new ListAdapter(this));

    mPullToRefreshLayout = findViewById(R.id.pullToRefreshLayout);
    mPullToRefreshLayout.setColorAnimationArray(new int[]{Color.CYAN, Color.RED, Color.YELLOW, Color.MAGENTA});
    mPullToRefreshLayout.setOnRefreshListener(this);

    /*
    For FABRevealMenu checkout here:
    https://github.com/HarinTrivedi/FABRevealMenu-master
    */

    FloatingActionButton fab = findViewById(R.id.fab);
    fabMenu = findViewById(R.id.fabMenu);
    fabMenu.bindAncherView(fab);
    fabMenu.setCustomView(addCustomView());
}
 
@Override
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull final FloatingActionButton child, @NonNull View target, int type) {

    // If animation didn't start, we don't need to care about running the restore animation.
    // i.e.: when the user swipes to another tab in a viewpager. The onNestedPreScroll is never called.
    if (!fabAnimationStarted) {
        return;
    }

    // Animate back when the fling ended (TYPE_NON_TOUCH:非手指触碰手势输入类型,通常是手指离开屏幕后的惯性滑动事件)
    // or if the user made the touch up (TYPE_TOUCH:正常的屏幕触控驱动事件) but the fling didn't happen.
    if (type == ViewCompat.TYPE_NON_TOUCH || (type == ViewCompat.TYPE_TOUCH && !flingHappened)) {
        //ViewCompat.animate(child).translationY(0).start();
        fabAnimationStarted = false;
    }
}
 
源代码20 项目: Android-Tutorials   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final FloatingActionButton button = findViewById(R.id.fab);

    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(new Intent(MainActivity.this, NextActivity.class));
        }

    });

}
 
源代码21 项目: AndroidKeyValueStore   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
    testKVStore();
}
 
源代码22 项目: AndroidMaryTTS-Client   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    editTtsText = (EditText) findViewById(R.id.editTtsText);



    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String text = editTtsText.getText().toString().trim();
            if (!text.isEmpty()) {
                MaryLink.getInstance().startTTS(text);
            }
        }
    });
    h = new Handler();
    pd = new TransparentProgressDialog(this, R.drawable.spinner);
    r = new Runnable() {
        @Override
        public void run() {
            if (pd.isShowing()) {
                pd.dismiss();
            }
        }
    };
    if (MaryLink.getInstance() == null) {
        pd.show();
        h.postDelayed(r, 15000); //wait 15 sec. loading TTS voice models ...
    }
    //initialize MaryTTS and load modules, voice and language modules wait 15 sec.
    MaryLink.load(this);
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getComponent().inject(this);
    long userId = getIntent().getLongExtra(EXTRA_USER_ID, -1);
    mUserId = userId == -1 ? null : userId;

    if (mUserId == null) {
        setTitle(R.string.feed_title);
    } else {
        String name = getIntent().getStringExtra(EXTRA_USER_NAME);
        setTitle(getString(R.string.user_feed_title, name));
    }
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_feed);
    boolean showInput = mUserId == null || mUserId == mDemoConfig.getUserId();
    mBinding.inputText.setVisibility(showInput ? View.VISIBLE : View.GONE);
    String predefinedInput = getIntent().getStringExtra(EXTRA_POST_TEXT);
    if (StringUtils.isNotBlank(predefinedInput)) {
        mBinding.inputText.setText(predefinedInput);
    }
    initRecyclerView();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendPost();
        }
    });
    mBinding.swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mFeedController.fetchFeedAsync(true, mUserId);
        }
    });
}
 
源代码24 项目: v9porn   文件: ScaleDownShowBehavior.java
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton child, View dependency) {
    boolean returnValue = super.onDependentViewChanged(parent, child, dependency);
    if (dependency instanceof AppBarLayout) {
        CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        int fabBottomMargin = lp.bottomMargin;
        int distanceToScroll = child.getHeight() + fabBottomMargin;
        float ratio = (float) dependency.getY() / (float) toolbarHeight;
        child.setTranslationY(-distanceToScroll * ratio);
    }

    return returnValue;
}
 
private void initView(){
    infos = new ArrayList<RedPocketGroup>();

    fab_home = (FloatingActionButton)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_fab_home);
    fab_home.setOnClickListener(this);

    if (is_first_page==1){
        fab_home.setVisibility(View.GONE);
    }else{
        fab_home.setVisibility(View.VISIBLE);
    }

    mapView = (MapView)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_mapview);
    mBaiduMap  = mapView.getMap();

    rl_mark_info_container = (RelativeLayout)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_mark_info_windows);
    rl_mark_info_container.setVisibility(View.INVISIBLE);

    mBaiduMap.setOnMapClickListener(new BaiduMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng latLng) {
            rl_mark_info_container.setVisibility(View.INVISIBLE);
        }

        @Override
        public boolean onMapPoiClick(MapPoi mapPoi) {
            return false;
        }
    });
}
 
源代码26 项目: Rumble   文件: ScrollAwareFABBehavior.java
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout,
                                   FloatingActionButton child,
                                   View directTargetChild,
                                   View target,
                                   int nestedScrollAxes) {
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
    super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
    nestedScrollAxes);
}
 
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

//        getting the simple name of the activity
        final String CLASS_NAME = MainActivity.class.getSimpleName();

//        adding the logs
        Log.d(CLASS_NAME, "This is a debug log.");
        Log.e(CLASS_NAME, "This is a error log");
        Log.w(CLASS_NAME, "This is a warning log");
        Log.i(CLASS_NAME, "This is a info log");


    }
 
源代码28 项目: BeMusic   文件: AlbumActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_album);

    mAlbum = (Album)getIntent().getSerializableExtra("album");

    mColTbLayout = (CollapsingToolbarLayout)findViewById(R.id.album_col_toolbar_layout);
    mTb = (Toolbar)findViewById(R.id.album_toolbar);
    mThumbIv = (ImageView)findViewById(R.id.album_thumb);
    mRv = (RecyclerView)findViewById(R.id.album_rv);
    mFab = (FloatingActionButton)findViewById(R.id.album_start);

    mRv.setLayoutManager(new LinearLayoutManager(this));

    mAdapter = new DelegateAdapter(this);
    mRv.setAdapter(mAdapter);

    mFab.setOnClickListener(mClickListener);

    setSupportActionBar(mTb);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mColTbLayout.setTitle(mAlbum.getAlbum());
    Glide.with(this).load(mAlbum.getAlbumArt()).into(mThumbIv);

    List<Song> songList = PlayManager.getInstance(this).getAlbumSongList(mAlbum.getId());
    if (songList != null) {
        mAdapter.addAll(songList, new DelegateParser<Song>() {
            @Override
            public LayoutImpl parse(DelegateAdapter adapter, Song data) {
                return new SongDelegate(data);
            }
        });
        mAdapter.notifyDataSetChanged();
    }
}
 
源代码29 项目: Rumble   文件: ScrollAwareFABBehavior.java
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout,
                           FloatingActionButton child,
                           View target, int dxConsumed, int dyConsumed,
                           int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target,
            dxConsumed, dyConsumed, dxUnconsumed,dyUnconsumed);

    if ((dyConsumed > 0) && (child.getVisibility() == View.VISIBLE)) {
        child.hide();
    } else if ((dyConsumed < 0) && (child.getVisibility() != View.VISIBLE)) {
        child.show();
    }
}
 
源代码30 项目: CleanArch   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "waht do you want", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}