本文整理匯總了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);
}
}