本文整理汇总了Java中android.support.v7.widget.Toolbar.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setVisibility方法的具体用法?Java Toolbar.setVisibility怎么用?Java Toolbar.setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setVisibility方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onShowTab
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onShowTab(@NonNull final Context context,
@NonNull final TabSwitcher tabSwitcher, @NonNull final View view,
@NonNull final Tab tab, final int index, final int viewType,
@Nullable final Bundle savedInstanceState) {
TextView textView = findViewById(android.R.id.title);
textView.setText(tab.getTitle());
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setVisibility(tabSwitcher.isSwitcherShown() ? View.GONE : View.VISIBLE);
if (viewType != 0) {
EditText editText = findViewById(android.R.id.edit);
if (savedInstanceState == null) {
editText.setText(null);
}
editText.requestFocus();
}
}
示例2: onShowCustomView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (mCustomView != null) {
callback.onCustomViewHidden();
return;
}
mCustomView = view;
customViewContainer.setVisibility(View.VISIBLE);
Toolbar toolbar = (Toolbar) findViewById(R.id.browser_toolbar);
toolbar.setVisibility(View.GONE);
customViewContainer.addView(view);
mCustomViewCallback = callback;
}
示例3: onHideCustomView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onHideCustomView() {
super.onHideCustomView();
if (mCustomView == null)
return;
mCustomView.setVisibility(View.GONE);
customViewContainer.setVisibility(View.GONE);
Toolbar toolbar = (Toolbar) findViewById(R.id.browser_toolbar);
toolbar.setVisibility(View.VISIBLE);
customViewContainer.removeView(mCustomView);
mCustomViewCallback.onCustomViewHidden();
mCustomView = null;
}
示例4: onCreateView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_videos, container, false);
RecyclerView recyclerView = root.findViewById(R.id.recycler_view);
Toolbar toolbar = root.findViewById(R.id.toolbar);
if (!inTabsContainer) {
toolbar.setVisibility(View.VISIBLE);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
} else {
toolbar.setVisibility(View.GONE);
}
mSwipeRefreshLayout = root.findViewById(R.id.refresh);
mSwipeRefreshLayout.setOnRefreshListener(() -> getPresenter().fireRefresh());
ViewUtils.setupSwipeRefreshLayoutWithCurrentTheme(getActivity(), mSwipeRefreshLayout);
mEmpty = root.findViewById(R.id.empty);
int columns = getContext().getResources().getInteger(R.integer.videos_column_count);
StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(columns, StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(manager);
recyclerView.addOnScrollListener(new PicassoPauseOnScrollListener(Constants.PICASSO_TAG));
recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener() {
@Override
public void onScrollToLastElement() {
getPresenter().fireScrollToEnd();
}
});
mAdapter = new VideosAdapter(getActivity(), Collections.emptyList());
mAdapter.setVideoOnClickListener(this);
recyclerView.setAdapter(mAdapter);
resolveEmptyTextVisibility();
return root;
}
示例5: onCreateView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_albums_gallery, container, false);
Toolbar toolbar = view.findViewById(R.id.toolbar);
if(!hasHideToolbarExtra()){
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
} else {
toolbar.setVisibility(View.GONE);
}
mSwipeRefreshLayout = view.findViewById(R.id.refresh);
mSwipeRefreshLayout.setOnRefreshListener(this);
ViewUtils.setupSwipeRefreshLayoutWithCurrentTheme(getActivity(), mSwipeRefreshLayout);
RecyclerView recyclerView = view.findViewById(R.id.list);
mEmptyText = view.findViewById(R.id.empty);
int columnCount = getResources().getInteger(R.integer.photos_albums_column_count);
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), columnCount));
recyclerView.addOnScrollListener(new PicassoPauseOnScrollListener(Constants.PICASSO_TAG));
mAdapter = new VkPhotoAlbumsAdapter(getActivity(), Collections.emptyList());
mAdapter.setClickListener(this);
recyclerView.setAdapter(mAdapter);
mFab = view.findViewById(R.id.fab);
mFab.setOnClickListener(v -> getPresenter().fireCreateAlbumClick());
return view;
}
示例6: onCreateView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_local_albums_gallery, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
if(!hasHideToolbarExtra()){
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
} else {
toolbar.setVisibility(View.GONE);
}
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh);
mSwipeRefreshLayout.setOnRefreshListener(this);
ViewUtils.setupSwipeRefreshLayoutWithCurrentTheme(getActivity(), mSwipeRefreshLayout);
int columnCount = getResources().getInteger(R.integer.photos_albums_column_count);
RecyclerView.LayoutManager manager = new StaggeredGridLayoutManager(columnCount, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView = (RecyclerView) view.findViewById(R.id.list);
mRecyclerView.setLayoutManager(manager);
mRecyclerView.addOnScrollListener(new PicassoPauseOnScrollListener(LocalPhotoAlbumsAdapter.PICASSO_TAG));
mAlbumsAdapter = new LocalPhotoAlbumsAdapter(Collections.emptyList());
mAlbumsAdapter.setClickListener(this);
mRecyclerView.setAdapter(mAlbumsAdapter);
mEmptyTextView = (TextView)view.findViewById(R.id.empty);
return view;
}
示例7: initBaseViews
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initBaseViews() {
mToolbar = (Toolbar) findViewById(R.id.toolbar_media_gallery);
if (getSupportActionBar() != null) {
mToolbar.setVisibility(View.GONE);
getSupportActionBar().setTitle(String.valueOf(title));
} else {
setSupportActionBar(mToolbar);
mToolbar.setTitle(String.valueOf(title));
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
示例8: setNoTitle
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
* Hide the toolbar
* @param toolbar
* @param needTitle
*/
private static void setNoTitle(Toolbar toolbar, boolean needTitle) {
if(needTitle) {
toolbar.setVisibility(View.VISIBLE);
} else {
toolbar.setVisibility(View.INVISIBLE);
}
}
示例9: adaptToolbarVisibility
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
* Adapts the visibility of the toolbars, which are shown, when the tab switcher is shown.
*/
private void adaptToolbarVisibility() {
Toolbar[] toolbars = getToolbars();
if (toolbars != null) {
for (Toolbar toolbar : toolbars) {
toolbar.setVisibility(
getTabSwitcher().isSwitcherShown() && getModel().areToolbarsShown() ?
View.VISIBLE : View.INVISIBLE);
}
}
// TODO: Detach and re-inflate layout
}
示例10: paintStatusbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void paintStatusbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar3);
toolbar.setVisibility(GONE);
setTitle(getString(R.string.title_enter_details));
//------------------ try to paint the statusbar -------------------------------
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(getResources().getColor(PIBLUE));
}
}
示例11: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_capture_view);
mActivity = this;
mCaptureFragment = new CaptureFragment();
mCaptureFragment.setAnalyzeCallback(analyzeCallback);
getSupportFragmentManager().beginTransaction().replace(R.id.fl_zxing_container, mCaptureFragment).commit();
mCaptureFragment.setCameraInitCallBack(new CaptureFragment.CameraInitCallBack() {
@Override
public void callBack(Exception e) {
if (e != null) {
e.printStackTrace();
}
}
});
boolean isShow = getIntent().getBooleanExtra(CodeUtils.EXTRA_SHOW_SCAN_TITLE, false);
if (isShow) {
Toolbar about_toolbar = (Toolbar) findViewById(R.id.about_toolbar);
about_toolbar.setVisibility(View.VISIBLE);
setSupportActionBar(about_toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
}
findViewById(R.id.tv_album).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CodeUtils.openAlbum(mActivity, REQUEST_IMAGE);
}
});
}
}
示例12: adaptToolbarVisibility
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
* Adapts the visibility of the toolbars, which are shown, when the tab switcher is shown.
*/
private void adaptToolbarVisibility() {
Toolbar[] toolbars = getToolbars();
if (toolbars != null) {
for (Toolbar toolbar : toolbars) {
toolbar.setVisibility(
getModel().areToolbarsShown() ? View.VISIBLE : View.INVISIBLE);
}
}
}
示例13: hideToolBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void hideToolBar() {
Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar_call);
toolbar.setVisibility(View.GONE);
}
示例14: doOldToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void doOldToolbar() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setVisibility(View.VISIBLE);
}