本文整理汇总了Java中android.support.design.widget.FloatingActionButton.show方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.show方法的具体用法?Java FloatingActionButton.show怎么用?Java FloatingActionButton.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@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(new FloatingActionButton.OnVisibilityChangedListener() {
/**
* Called when a FloatingActionButton has been hidden
*
* @param fab the FloatingActionButton that was hidden.
*/
@Override
public void onHidden(FloatingActionButton fab) {
super.onShown(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
示例2: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@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();
RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,false);
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,true);
child.show();
}
}
示例3: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
//Logger.d("FABBehavour", String.valueOf(dyConsumed));
if (child.isShown() && dyConsumed > 0) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onHidden(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (!child.isShown() && dyConsumed < 0) {
child.show();
}
}
示例4: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final
FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
/** design lib 升级到 25.1.0 导致 child.hide() 效果失效,法克哟
* http://stackoverflow.com/questions/41761736/android-design-library-25-1-0-causes-floatingactionbutton-behavior-to-stop-worki
*/
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onHidden(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
示例5: setUpActivity
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
protected void setUpActivity(String title, int navDrawerId, boolean withFab, boolean withRefresh) {
getActivity().setTitle(title);
if (mListener != null) {
mListener.checkNavigationDrawerItem(navDrawerId);
}
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
if (withFab) {
fab.show();
} else {
fab.hide();
}
fab.setOnClickListener(null);
SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
srl.setEnabled(withRefresh);
srl.setRefreshing(false);
srl.setOnRefreshListener(null);
}
示例6: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child,
@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
// GONE causes it to stop dispatching events...
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
示例7: processWord
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
private void processWord(EditText editText) {
Toast.makeText(AnagramsActivity.this,"hey",Toast.LENGTH_LONG);
TextView resultView = (TextView) findViewById(R.id.resultView);
String word = editText.getText().toString().trim().toLowerCase();
ArrayList<String> result;
//currentWord = word;
if (word.length() == 0) {
return;
}
String color = "#cc0029";
if (dictionary.isGoodWord(word, currentWord)){
//Toast.makeText(AnagramsActivity.this,word,Toast.LENGTH_LONG);
if (anagrams.contains(word)) {
anagrams.remove(word);
result = (ArrayList<String>) dictionary.getAnagramsWithOneMoreLetter(word);
color = "#00aa29";
resultView.append(Html.fromHtml(String.format("<font color=%s>%s</font><BR>", color, result)));
}
} else {
word = "X " + word;
resultView.append(Html.fromHtml(String.format("<font color=%s>%s</font><BR>", color, word)));
}
editText.setText("");
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.show();
}
示例8: handleIntent
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void handleIntent(FloatingActionButton view, Intent intent) {
if (intent.getDataString().startsWith(URI_SHOW)) {
view.show();
} else if (intent.getDataString().startsWith(URI_HIDE)) {
view.hide();
}
}
示例9: animateFab
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
private void animateFab(int tabPos) {
FloatingActionButton fabTasks = (FloatingActionButton) findViewById(R.id.fab_tasks);
FloatingActionButton fabHabits = (FloatingActionButton) findViewById(R.id.fab_habits);
FloatingActionButton fabTimeLeft = (FloatingActionButton) findViewById(R.id.fab_time_left);
switch (tabPos) {
case 0:
fabTasks.show();
fabHabits.hide();
fabTimeLeft.hide();
break;
case 1:
fabTasks.hide();
fabHabits.show();
fabTimeLeft.hide();
break;
case 2:
fabTasks.hide();
fabHabits.hide();
fabTimeLeft.show();
break;
default:
fabTasks.hide();
fabHabits.hide();
fabTimeLeft.hide();
break;
}
}
示例10: onDependentViewChanged
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override public boolean onDependentViewChanged(@NonNull
final CoordinatorLayout parent, @NonNull
final FloatingActionButton child, final View dependency) {
log(TAG, INFO, "onDependentViewChanged: " + dependency);
final List<View> list = parent.getDependencies(child);
ViewGroup.MarginLayoutParams params = ((ViewGroup.MarginLayoutParams) child.getLayoutParams());
int bottomMargin = (params.bottomMargin + params.rightMargin) - (params.topMargin + params.leftMargin);
float t = 0;
float t2 = 0;
float t3 = 0;
boolean result = false;
for (View dep : list) {
if (Snackbar.SnackbarLayout.class.isInstance(dep)) {
t += dep.getTranslationY() - dep.getHeight();
result = true;
} else if (BottomNavigation.class.isInstance(dep)) {
BottomNavigation navigation = (BottomNavigation) dep;
t2 = navigation.getTranslationY() - navigation.getHeight() + bottomMargin;
t += t2;
result = true;
if (navigationBarHeight > 0) {
if (!navigation.isExpanded()) {
child.hide();
} else {
child.show();
}
}
}
}
if (navigationBarHeight > 0 && t2 < 0) {
t = Math.min(t2, t + navigationBarHeight);
}
child.setTranslationY(t);
return result;
}
示例11: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
View target, int dxConsumed,
int dyConsumed, int dxUnconsumed,
int dyUnconsumed) {
if(dyConsumed > 0 && child.getVisibility() == View.INVISIBLE){
child.show();
}else if(dyConsumed < 0){
//官方的hide方法会设置为gone,而这个方法在view为gone时不会调用
child.setVisibility(View.INVISIBLE);
}
}
示例12: SetMainActivity
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
public void SetMainActivity(boolean actionmenu, String MainTitle, String subtitle) {
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.MainFAB);
ActionbarMenu.findItem(R.id.ClearAllVar).setVisible(actionmenu);
actionBar.setTitle(MainTitle);
if (((GlobalValues) getApplication()).GetCompleteList().isEmpty())
actionBar.setSubtitle(null);
else
actionBar.setSubtitle(subtitle);
fab.show();
if (((GlobalValues) getApplication()).GetCompleteList().isEmpty())
t.setText(R.string.OpenHint);
else
t.setText(null);
}
示例13: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
// User scrolled down and the FAB is currently visible -> hide the FAB
child.hide();
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
// User scrolled up and the FAB is currently not visible -> show the FAB
child.show();
}
}
示例14: onDependentViewChanged
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton child, View dependency) {
/**
* Because we are not moving it, we always return false in this method.
*/
if (offset == 0)
setOffsetValue(parent);
if (mBottomSheetBehaviorRef == null)
getBottomSheetBehavior(parent);
int DyFix = getDyBetweenChildAndDependency(child, dependency);
if ((child.getY() + DyFix) < offset)
child.hide();
else if ((child.getY() + DyFix) >= offset) {
/**
* We are calculating every time point in Y where BottomSheet get {@link BottomSheetBehaviorGoogleMapsLike#STATE_COLLAPSED}.
* If PeekHeight change dynamically we can reflect the behavior asap.
*/
if (mBottomSheetBehaviorRef == null || mBottomSheetBehaviorRef.get() == null)
getBottomSheetBehavior(parent);
int collapsedY = dependency.getHeight() - mBottomSheetBehaviorRef.get().getPeekHeight();
if ((child.getY() + DyFix) > collapsedY)
child.hide();
else
child.show();
}
return false;
}
示例15: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@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);
//child -> Floating Action Button
if (child.getVisibility() == View.VISIBLE && dyConsumed > 0) {
child.hide();
} else if (child.getVisibility() == View.GONE && dyConsumed < 0) {
child.show();
}
}