本文整理汇总了Java中android.view.ViewStub.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java ViewStub.setVisibility方法的具体用法?Java ViewStub.setVisibility怎么用?Java ViewStub.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewStub
的用法示例。
在下文中一共展示了ViewStub.setVisibility方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGraphObjectView
import android.view.ViewStub; //导入方法依赖的package包/类
protected View createGraphObjectView(T graphObject) {
View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);
ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
if (checkboxStub != null) {
if (!getShowCheckbox()) {
checkboxStub.setVisibility(View.GONE);
} else {
CheckBox checkBox = (CheckBox) checkboxStub.inflate();
updateCheckboxState(checkBox, false);
}
}
ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
if (!getShowPicture()) {
profilePicStub.setVisibility(View.GONE);
} else {
ImageView imageView = (ImageView) profilePicStub.inflate();
imageView.setVisibility(View.VISIBLE);
}
return result;
}
示例2: showAlternativeView
import android.view.ViewStub; //导入方法依赖的package包/类
void showAlternativeView(int viewType) {
FrameLayout recyclerFrame = findViewById(R.id.recycler_frame);
recyclerFrame.setVisibility(View.GONE);
mShowCancelAll = false;
switch (viewType) {
case ZERO_DOWNLOAD_TYPE:
ViewStub zeroView = findViewById(R.id.zero_downloads);
zeroView.setVisibility(View.VISIBLE);
break;
case FINISHED_DOWNLOAD_TYPE:
ViewStub finishedView = findViewById(R.id.finished_downloads);
finishedView.setVisibility(View.VISIBLE);
break;
case CANCELLED_DOWNLOAD_TYPE:
ViewStub cancelledView = findViewById(R.id.cancelled_downloads);
cancelledView.setVisibility(View.VISIBLE);
break;
}
new Handler().postDelayed(this::finish, 10000);
}
示例3: onCreateView
import android.view.ViewStub; //导入方法依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_global_user_list, container, false);
RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
ViewStub zeroView = view.findViewById(R.id.zero_global_user_notes);
if ((bookmarkItems.isEmpty() && highlightItems.isEmpty())) {
recyclerView.setVisibility(View.GONE);
zeroView.setVisibility(View.VISIBLE);
} else {
recyclerView.setAdapter(adapter);
}
return view;
}
示例4: onCreateView
import android.view.ViewStub; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_bookmark_list, container, false);
// Set the adapter
RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
ViewStub zeroView = view.findViewById(R.id.zero_bookmarks);
UserDataDBHelper userDataDBHelper = UserDataDBHelper.getInstance(getContext(), bookId);
ArrayList<Bookmark> bookmarks = userDataDBHelper.getAllBookmarks(UserDataDBContract.BookmarkEntry.COLUMN_NAME_PAGE_ID);
if (bookmarks.size() != 0) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
bookmarkRecyclerViewAdapter = new BookmarkRecyclerViewAdapter(bookmarks, mListener, getContext(), userDataDBHelper, getActivity().getPreferences(Context.MODE_PRIVATE));
bookmarkRecyclerViewAdapter.setHasStableIds(true);
recyclerView.setAdapter(bookmarkRecyclerViewAdapter);
} else {
recyclerView.setVisibility(View.GONE);
zeroView.setVisibility(View.VISIBLE);
}
return view;
}
示例5: initViews
import android.view.ViewStub; //导入方法依赖的package包/类
protected void initViews() {
inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.ultimate_recycler_view_layout, this);
mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
mSwipeRefreshLayout = (VerticalSwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
setScrollbars();
mSwipeRefreshLayout.setEnabled(false);
if (mRecyclerView != null) {
mRecyclerView.setClipToPadding(mClipToPadding);
if (mPadding != -1.1f) {
mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
}
defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
setDefaultScrollListener();
/**
* empty view setup
*/
mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
if (mEmptyId != 0) {
mEmpty.setLayoutResource(mEmptyId);
mEmptyView = mEmpty.inflate();
mEmpty.setVisibility(View.GONE);
}
/**
* floating button setup
*/
mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
}
示例6: initViews
import android.view.ViewStub; //导入方法依赖的package包/类
@Override
protected void initViews() {
//super.initViews();
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom_recycler_view_layout, this);
mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
mSwipeRefreshLayout = null;
if (mRecyclerView != null) {
mRecyclerView.setClipToPadding(mClipToPadding);
if (mPadding != -1.1f) {
mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
}
defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
setDefaultScrollListener();
mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
mEmpty.setLayoutResource(mEmptyId);
mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
if (mEmptyId != 0)
mEmptyView = mEmpty.inflate();
mEmpty.setVisibility(View.GONE);
if (mFloatingButtonId != 0) {
mFloatingButtonView = mFloatingButtonViewStub.inflate();
mFloatingButtonView.setVisibility(View.VISIBLE);
}
}
示例7: onCreateView
import android.view.ViewStub; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_highlight_list, container, false);
RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
ViewStub zeroView = view.findViewById(R.id.zero_highlights);
UserDataDBHelper userDataDBHelper = UserDataDBHelper.getInstance(getContext(), bookId);
ArrayList<Highlight> userDataDBHelperAllHighlights = userDataDBHelper.getAllHighlights();
if (userDataDBHelperAllHighlights.size() != 0) {
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
highlightRecyclerViewAdapter = new HighlightRecyclerViewAdapter(
userDataDBHelperAllHighlights,
mListener,
getContext().getApplicationContext(),
getActivity().getPreferences(Context.MODE_PRIVATE));
highlightRecyclerViewAdapter.setHasStableIds(true);
recyclerView.setAdapter(highlightRecyclerViewAdapter);
} else {
recyclerView.setVisibility(View.GONE);
zeroView.setVisibility(View.VISIBLE);
}
return view;
}
示例8: showEmpty
import android.view.ViewStub; //导入方法依赖的package包/类
private void showEmpty() {
ViewStub stub = (ViewStub) findViewById(R.id.empty_layout);
if (stub != null) {
stub.setVisibility(0);
}
this.recyclerView.setVisibility(8);
updateMenu();
}
示例9: initViews
import android.view.ViewStub; //导入方法依赖的package包/类
@Override
protected void initViews() {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.swipeable_ultimate_recycler_view_layout, this);
mRecyclerView = (SwipeListView) view.findViewById(R.id.ultimate_list);
mSwipeRefreshLayout = (VerticalSwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
setScrollbars();
mSwipeRefreshLayout.setEnabled(false);
if (mRecyclerView != null) {
mRecyclerView.setClipToPadding(mClipToPadding);
if (mPadding != -1.1f) {
mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
}
defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
setDefaultScrollListener();
mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
mEmpty.setLayoutResource(mEmptyId);
mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
if (mEmptyId != 0)
mEmptyView = mEmpty.inflate();
mEmpty.setVisibility(View.GONE);
if (mFloatingButtonId != 0) {
mFloatingButtonView = mFloatingButtonViewStub.inflate();
mFloatingButtonView.setVisibility(View.VISIBLE);
}
}