List of usage examples for android.widget ListView setCacheColorHint
@Override public void setCacheColorHint(int color)
From source file:com.github.mobile.gauges.ui.ReferrerListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listView = getListView(); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setFastScrollEnabled(true); listView.setDividerHeight(0);/* w w w . jav a 2 s.co m*/ if (getListAdapter() == null) listView.addHeaderView( getActivity().getLayoutInflater().inflate(layout.referrer_list_item_labels, null), null, false); }
From source file:com.github.mobile.gauges.ui.GaugeListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listView = getListView(); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setDivider(getResources().getDrawable(drawable.gauge_divider)); listView.setDividerHeight(2);/*w w w .j a va 2s . c om*/ listView.setFastScrollEnabled(true); }
From source file:com.github.mobile.gauges.ui.ContentListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listView = getListView(); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setFastScrollEnabled(true); listView.setDividerHeight(0);//from w w w . j a v a2s . c om if (getListAdapter() == null) listView.addHeaderView(getActivity().getLayoutInflater().inflate(layout.content_list_item_labels, null), null, false); }
From source file:com.example.android.hcgallery.TitlesFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //Current position should survive screen rotations. if (savedInstanceState != null) { mCategory = savedInstanceState.getInt("category"); mCurPosition = savedInstanceState.getInt("listPosition"); }//from w w w . ja va 2s . c om populateTitles(mCategory); ListView lv = getListView(); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); lv.setCacheColorHint(Color.TRANSPARENT); selectPosition(mCurPosition); }
From source file:com.actionbarsherlock.sample.hcgallery.TitlesFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //Current position should survive screen rotations. if (savedInstanceState != null) { mCategory = savedInstanceState.getInt("category"); mCurPosition = savedInstanceState.getInt("listPosition"); }/* ww w. j a v a2s .co m*/ populateTitles(mCategory); ListView lv = getListView(); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); lv.setCacheColorHint(Color.TRANSPARENT); lv.setOnItemLongClickListener(new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) { final String title = (String) ((TextView) v).getText(); // Set up clip data with the category||entry_id format. final String textData = String.format("%d||%d", mCategory, pos); ClipData data = ClipData.newPlainText(title, textData); v.startDrag(data, new MyDragShadowBuilder(v), null, 0); return true; } }); selectPosition(mCurPosition); }
From source file:com.acrylicgoat.bcponline.fragments.CPListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); lv.setCacheColorHint(Color.TRANSPARENT); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); if (CPUtil.isTabletDevice(getActivity().getWindowManager().getDefaultDisplay(), getActivity())) { Category item = contentList.get(0); ddgSelectedListener.onDDGSelected(item.getUrl()); dualFragments = true;//from w ww . j a va 2s . c o m } aBar = sherActivity.getActionBar(); if (dualFragments) { landAdapter = new LandscapeListAdapter(getActivity().getApplicationContext(), contentList); setListAdapter(landAdapter); } else { adapter = new ListAdapter(getActivity().getApplicationContext(), contentList); setListAdapter(adapter); lv.setBackgroundResource(R.color.color_list_background); } }
From source file:org.sociotech.fishification.ui.fragments.CreateFishFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Restore preferences SharedPreferences settings = getActivity().getSharedPreferences(MainActivity.PREFS_NAME, 0); String authorName = settings.getString("authorName", null); String fishName = settings.getString("fishName", null); int fishTypeIndex = settings.getInt("fishTypeIndex", -1); // Set Author name if (authorName != null && !authorName.isEmpty()) { setEditText(R.id.authorNameText, authorName); } else {// ww w . j ava 2s .com getActivity().getSupportLoaderManager().initLoader(0, null, this); } // Set Fish Name if (fishName != null && !fishName.isEmpty()) { setEditText(R.id.fishNameText, fishName); } ListView lv = getListView(); lv.setCacheColorHint(Color.TRANSPARENT); // Improves scrolling performance lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // Set Fish Type if (fishTypeIndex != -1) { lv.setItemChecked(fishTypeIndex, true); m_fishSelectedListener.onFishSelected(fishTypeIndex); } }
From source file:com.conferenceengineer.android.iosched.ui.ExploreFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.WHITE); final ListView listView = getListView(); listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(Color.WHITE); mAdapter = new TracksAdapter(getActivity(), false); setListAdapter(mAdapter);/*from www . j av a 2s.c o m*/ // Override default ListView empty-view handling listView.setEmptyView(null); mEmptyView.setVisibility(View.VISIBLE); mAdapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (mAdapter.getCount() > 0) { mEmptyView.setVisibility(View.GONE); mAdapter.unregisterDataSetObserver(this); } } }); }
From source file:in.yangxu.navigationdrawer.view.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.homelistviewlayout, container, false); final SwipeRefreshLayout mSwipeRefreshLayout = (SwipeRefreshLayout) v .findViewById(R.id.activity_main_swipe_refresh_layout); if (position == 0) { mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override//from w ww.j ava 2 s. co m public void onRefresh() { mSwipeRefreshLayout.setRefreshing(false); } }); ListView listView = (ListView) v.findViewById(R.id.activity_main_listview); listView.setCacheColorHint(Color.TRANSPARENT); listView.setDividerHeight(0); Item item1 = new Item(); Item item2 = new Item(); Item item3 = new Item(); list.add(item1); list.add(item2); list.add(item3); adapter = new ItemAdapter(list, getActivity()); listView.setAdapter(adapter); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (lastVisibleItem == totalItemCount1 && scrollState == SCROLL_STATE_IDLE) { Item item4 = new Item(); list.add(item4); adapter.notifyDataSetChanged(); } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { lastVisibleItem = firstVisibleItem + visibleItemCount; totalItemCount1 = totalItemCount; } }); } else { mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mSwipeRefreshLayout.setRefreshing(false); } }); ListView listView = (ListView) v.findViewById(R.id.activity_main_listview); listView.setCacheColorHint(Color.TRANSPARENT); listView.setDividerHeight(0); Item item1 = new Item(); list.add(item1); adapter = new ItemAdapter(list, getActivity()); listView.setAdapter(adapter); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (lastVisibleItem == totalItemCount1 && scrollState == SCROLL_STATE_IDLE) { Item item4 = new Item(); list.add(item4); adapter.notifyDataSetChanged(); } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { lastVisibleItem = firstVisibleItem + visibleItemCount; totalItemCount1 = totalItemCount; } }); } return v; }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.ExploreFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.WHITE); final ListView listView = getListView(); listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(Color.WHITE); addMapHeaderView();// ww w .j ava 2 s. co m mAdapter = new TracksAdapter(getActivity(), false); setListAdapter(mAdapter); // Override default ListView empty-view handling listView.setEmptyView(null); mEmptyView.setVisibility(View.VISIBLE); mAdapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (mAdapter.getCount() > 0) { mEmptyView.setVisibility(View.GONE); mAdapter.unregisterDataSetObserver(this); } } }); }