本文整理匯總了Java中android.support.v7.widget.RecyclerView.setVisibility方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setVisibility方法的具體用法?Java RecyclerView.setVisibility怎麽用?Java RecyclerView.setVisibility使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.setVisibility方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toggleListViewVisibility
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected void toggleListViewVisibility(boolean expand, RecyclerView view, @PieChartType int chartType) {
StatsAdapter adapter = new StatsAdapter(context, new ArrayList<PieChartItem>(), "");
switch (chartType) {
case LANGUAGE_CHART_ID:
adapter = languageListAdapter;
break;
case EDITORS_CHART_ID:
adapter = editorsListAdapter;
break;
case OS_CHART_ID:
adapter = osListAdapter;
break;
default:
break;
}
view.setVisibility(expand ? View.VISIBLE : View.GONE);
if (!expand) {
view.setAdapter(new StatsAdapter(context, adapter.getItemList(), ""));
}
}
示例2: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的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;
}
示例3: init
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void init() {
Collections.sort(scheduleList, new Comparator<Schedule>() {
@Override
public int compare(Schedule o1, Schedule o2) {
return (o1.getTime().compareTo(o2.getTime()));
}
});
scheduleRecyclerView = (RecyclerView)
customView.findViewById(R.id.shedule_recyclerview);
scheduleAdapter = new ScheduleAdapter(getContext(), scheduleList);
scheduleRecyclerView.setAdapter(scheduleAdapter);
LinearLayoutManager layoutManager =
new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
scheduleRecyclerView.setLayoutManager(layoutManager);
scheduleRecyclerView.setItemAnimator(new DefaultItemAnimator());
scheduleRecyclerView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.INVISIBLE);
}
示例4: onPostExecute
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onPostExecute(String result) {
if (getActivity() != null) {
progressBar.setVisibility(View.GONE);
checkGroups();
RecyclerView recyclerView = (RecyclerView) getActivity().findViewById(R.id.recycler_groups);
recyclerView.setVisibility(View.VISIBLE);
recyclerView.setAdapter(new GroupsFragment.Adapter(groupses,
getActivity().getApplicationContext(), userClass,
recyclerView, firstGrades));
final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
}
}
示例5: onCreate
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_subscribed);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
RecyclerView recyclerView = findViewById(R.id.subscribed_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
Type listType = new TypeToken<ArrayList<Alert>>(){}.getType();
List<Alert> alerts = Utility.loadData("alerts", listType);
TextView emptyView = findViewById(R.id.empty_view);
if (alerts == null || alerts.isEmpty()) {
recyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
} else {
recyclerView.setAdapter(new SubscribedAdapter(this, alerts));
recyclerView.setVisibility(View.VISIBLE);
emptyView.setVisibility(View.GONE);
}
}
示例6: initView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void initView() {
ToolBarOption toolBarOption = new ToolBarOption();
toolBarOption.setNeedNavigation(false);
setToolBar(toolBarOption);
display = (RecyclerView) findViewById(R.id.rcv_search_display);
display.setVisibility(GONE);
findViewById(R.id.ll_search_container).setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
finish();
return true;
}
});
}
示例7: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.fragment_profiletab3, container, false);
nodata = (TextView) view.findViewById(R.id.nodata);
recyclerView = (RecyclerView) view.findViewById(R.id.news_list);
progress = (ProgressBar) view.findViewById(R.id.progress);
list = new ArrayList<>();
adapter = new NewsFeedAdapter(getContext());
recyclerView.setAdapter(adapter);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(linearLayoutManager);
sharedPref = new SharedPref(getContext());
Log.d("id",sharedPref.getUserId());
if(savedInstanceState==null){
getData(1,sharedPref.getUserId());
progress.setVisibility(View.VISIBLE);
}
else{
if(savedInstanceState.getParcelableArray(USER_POST)!=null){
recyclerView.setVisibility(View.VISIBLE);
list = savedInstanceState.getParcelableArrayList(USER_POST);
adapter.refresh(list);
}
else{
nodata.setVisibility(View.VISIBLE);
nodata.setText("No Post Uploaded");
}
}
return view;
}
示例8: HeaderViewHolder
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
HeaderViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
RecyclerView recyclerView = itemView.findViewById(R.id.recyclerview);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, true));
recyclerView.setHasFixedSize(true);
String[] urls = mContext.getResources().getStringArray(R.array.about_social_links);
if (urls.length == 0) {
recyclerView.setVisibility(View.GONE);
subtitle.setPadding(
subtitle.getPaddingLeft(),
subtitle.getPaddingTop(),
subtitle.getPaddingRight(),
subtitle.getPaddingBottom() + mContext.getResources().getDimensionPixelSize(R.dimen.content_margin));
} else {
if (recyclerView.getLayoutParams() instanceof LinearLayout.LayoutParams) {
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) recyclerView.getLayoutParams();
if (urls.length < 7) {
params.width = LinearLayout.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.CENTER_HORIZONTAL;
recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
}
}
recyclerView.setAdapter(new AboutSocialAdapter(mContext, urls));
}
subtitle.setHtml(mContext.getResources().getString(R.string.about_desc));
CardView card = itemView.findViewById(R.id.card);
if (!Preferences.get(mContext).isShadowEnabled()) {
if (card != null) card.setCardElevation(0);
profile.setShadowRadius(0f);
profile.setShadowColor(Color.TRANSPARENT);
}
}
示例9: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的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;
}
示例10: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
Log.i(TAG, "onCreateView");
customView = inflater.inflate(R.layout.home_fragment_slidebar_schedule, container, false);
progressBar = (RelativeLayout) customView.findViewById(R.id.progressbar_schedule);
scheduleRecyclerView = (RecyclerView)
customView.findViewById(R.id.shedule_recyclerview);
radioButtonToday = (RadioButton) customView.findViewById(schedule_today_rb);
radioButtonTomorrow = (RadioButton) customView.findViewById(schedule_tomorrow_rb);
radioButtonAll = (RadioButton) customView.findViewById(schedule_all_rb);
radioGroup = (RadioGroup) customView.findViewById(R.id.radio_group_schedule);
txtMsgNoContent = (TextView) customView.findViewById(R.id.message_label_sc);
handler = new Handler(getActivity().getMainLooper());
radioGroup.setOnCheckedChangeListener(this);
if(schedule_all_rb == rbSelectedId)
radioButtonAll.setChecked(true);
if(schedule_today_rb == rbSelectedId)
radioButtonToday.setChecked(true);
if(schedule_tomorrow_rb == rbSelectedId)
radioButtonTomorrow.setChecked(true);
progressBar.setVisibility(View.VISIBLE);
txtMsgNoContent.setVisibility(View.INVISIBLE);
scheduleRecyclerView.setVisibility(View.INVISIBLE);
init();
return customView;
}
示例11: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home_lines, container, false);
// Set the adapter
Context context = view.getContext();
recyclerView = (RecyclerView) view.findViewById(R.id.list);
if (mColumnCount <= 1) {
recyclerView.setLayoutManager(new LinearLayoutManager(context));
} else {
recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
}
recyclerView.setVisibility(View.GONE);
progressBar = (ProgressBar) view.findViewById(R.id.loading_indicator);
progressBar.setVisibility(View.VISIBLE);
updateInformationView = (TextView) view.findViewById(R.id.update_information);
// fix scroll fling. less than ideal, but apparently there's still no other solution
recyclerView.setNestedScrollingEnabled(false);
IntentFilter filter = new IntentFilter();
filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
filter.addAction(LineStatusCache.ACTION_LINE_STATUS_UPDATE_STARTED);
filter.addAction(LineStatusCache.ACTION_LINE_STATUS_UPDATE_SUCCESS);
filter.addAction(LineStatusCache.ACTION_LINE_STATUS_UPDATE_FAILED);
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
bm.registerReceiver(mBroadcastReceiver, filter);
redraw(context);
return view;
}
示例12: showHideEmptyMessage
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void showHideEmptyMessage() {
if (getView() != null) {
RecyclerView profileList = getView().findViewById(R.id.profile_activity_list);
if (profileList.getAdapter().getItemCount() == 0) {
profileList.setVisibility(View.GONE);
getView().findViewById(R.id.empty).setVisibility(View.VISIBLE);
} else {
profileList.setVisibility(View.VISIBLE);
getView().findViewById(R.id.empty).setVisibility(View.GONE);
}
}
}
示例13: setRecycleView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void setRecycleView() {
SharedPreferences selectedAppPreference = SelectedApplication.this.getSharedPreferences("SelectedApp", Context.MODE_PRIVATE);
String AppName = selectedAppPreference.getString("AppName", null);
String PacName = selectedAppPreference.getString("PacName", null);
String AppImage = selectedAppPreference.getString("AppImage", null);
String AppSource = selectedAppPreference.getString("AppSource", null);
String AppData = selectedAppPreference.getString("AppData", null);
if (PacName != null && !PacName.equals("")) {
String[] split1 = AppName.split("\\+");
String[] split2 = PacName.split("\\+");
String[] split3 = AppImage.split("\\+");
String[] split4 = AppSource.split("\\+");
String[] split5 = AppData.split("\\+");
result.clear();
for (int i = 0; i < split2.length; i++) {
AppInfo newInfo = new AppInfo();
newInfo.setAppName(split1[i]);
newInfo.setPacName(split2[i]);
newInfo.setBitmapString(Uri.parse(split3[i]));
newInfo.setSource(split4[i]);
newInfo.setData(split5[i]);
result.add(newInfo);
}
}
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(SelectedApplication.this);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
// String syncConnPref = sharedPref.getString("OutputVie", "");
RecyclerViewAdapterSelectedApp adapter = new RecyclerViewAdapterSelectedApp(SelectedApplication.this, result);
recyclerView.setVisibility(View.VISIBLE);
recyclerView.setLayoutManager(new LinearLayoutManager(SelectedApplication.this));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter);
mItemTouchHelper = new ItemTouchHelper(callback);
mItemTouchHelper.attachToRecyclerView(recyclerView);
}
示例14: toggleListViewVisibility
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void toggleListViewVisibility(boolean expand, RecyclerView view, StatsAdapter adapter) {
view.setVisibility(expand ? View.VISIBLE : View.GONE);
if (!expand) {
view.setAdapter(new StatsAdapter(context, adapter.getItemList(), ""));
}
}
示例15: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View myFragmentView = inflater.inflate(R.layout.fragment_noticias_lista, container, false);
//Obtem da View
mRecyclerView = (RecyclerView) myFragmentView.findViewById(R.id.rv_noticias);
mRecyclerView.setHasFixedSize(true);
//Define o LinearLayoutManager, que exibe os itens na vertical
LinearLayoutManager llm = new LinearLayoutManager(getActivity());
llm.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(llm);
//Obtem da View
mRelativeLayout = (RelativeLayout) myFragmentView.findViewById(R.id.pb_noticia);
//Obtem da View
mSwipeRefreshLayout = (SwipeRefreshLayout) myFragmentView.findViewById(R.id.srl_noticias);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorPrimaryDark);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Recarregar();
mSwipeRefreshLayout.setRefreshing(false);
}
});
//Verifica se as notícias existem
if (mNoticias == null)
//Baixa as notícias
new DownloadNoticias(container.getContext(), mRelativeLayout, mRecyclerView).execute(Utils.getUrlApiNoticia(getActivity()));
else {
//Define o Adapter e mostra as notícias
NoticiaAdapter n = new NoticiaAdapter(container.getContext(), mNoticias);
mRecyclerView.setAdapter(n);
mRecyclerView.setVisibility(View.VISIBLE);
mRelativeLayout.findViewById(R.id.pb_noticia_indeterminate).setVisibility(View.GONE);
mRelativeLayout.findViewById(R.id.tv_erro).setVisibility(View.GONE);
}
return myFragmentView;
}