Java Code Examples for android.widget.listview#setScrollBarStyle()
The following examples show how to use
android.widget.listview#setScrollBarStyle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseListFragment.java From Dashchan with Apache License 2.0 | 6 votes |
@Override public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_common, container, false); ListView listView = view.findViewById(android.R.id.list); emptyView = view.findViewById(R.id.error); emptyText = view.findViewById(R.id.error_text); emptyView.setVisibility(View.GONE); listView.setOnItemClickListener(this); registerForContextMenu(listView); ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); try { layoutParams.getClass().getDeclaredField("removeBorders").set(layoutParams, true); if (!C.API_MARSHMALLOW) { float density = ResourceUtils.obtainDensity(inflater.getContext()); int padding = (int) ((C.API_LOLLIPOP ? 8f : 16f) * density); listView.setPadding(padding, 0, padding, 0); } listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); } catch (Exception e) { // Reflective operation, ignore exception } this.listView = listView; return view; }
Example 2
Source File: AppListFragment.java From EventApp with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); int padding = (int) (getResources().getDisplayMetrics().density * 8); // 8dip ListView listView = getListView(); listView.setPadding(padding, 0, padding, 0); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setDivider(null); LayoutInflater inflater = LayoutInflater.from(getActivity()); View header = inflater.inflate(R.layout.list_header_footer, listView, false); View footer = inflater.inflate(R.layout.list_footer, listView, false); TextView tv = (TextView) footer.findViewById(R.id.footer); String str = getResources().getString(R.string.footer); MovementMethod method = LinkMovementMethod.getInstance(); tv.setMovementMethod(method); CharSequence html = Html.fromHtml(str); tv.setText(html); listView.addHeaderView(header, null, false); listView.addFooterView(footer, null, false); setTrack(7); }
Example 3
Source File: PreferencesListFragment.java From Linphone4Android with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); if (bundle != null) { xmlResID = bundle.getInt("xml"); } mPreferenceManager = onCreatePreferenceManager(); preferencesList = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null); preferencesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); addPreferencesFromResource(xmlResID); postBindPreferences(); }
Example 4
Source File: PreferenceListFragment.java From sms-ticket with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); if (b != null) { xmlId = b.getInt("xml"); } mPreferenceManager = onCreatePreferenceManager(); lv = (ListView)LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null); lv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); if (xmlId > 0) { addPreferencesFromResource(xmlId); } }
Example 5
Source File: PreferenceListFragment.java From android_dbinspector with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); if (getArguments() != null) { xmlId = getArguments().getInt(XML_ID); } mPreferenceManager = onCreatePreferenceManager(); lv = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.dbinspector_preference_list_content, null); lv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); addPreferencesFromResource(xmlId); postBindPreferences(); }
Example 6
Source File: PreferenceListFragment.java From screenstandby with GNU General Public License v2.0 | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); if(b != null) xmlId = b.getInt("xml"); mPreferenceManager = onCreatePreferenceManager(); lv = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null); lv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); addPreferencesFromResource(xmlId); postBindPreferences(); ((OnPreferenceAttachedListener)getActivity()).onPreferenceAttached(getPreferenceScreen(), xmlId); }
Example 7
Source File: SuperListview.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override protected void initAbsListView(View v) { View listView = v.findViewById(android.R.id.list); if (listView instanceof ListView) mList = (ListView) listView; else throw new IllegalArgumentException("SuperListView works with a List!"); if (mList != null) { mList.setClipToPadding(mClipToPadding); //getList().setDivider(mDivider); getList().setDividerHeight((int) mDividerHeight); mList.setOnScrollListener(this); if (mSelector != 0) mList.setSelector(mSelector); if (mPadding != -1.0f) { mList.setPadding(mPadding, mPadding, mPadding, mPadding); } else { mList.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom); } if (mScrollbarStyle != -1) mList.setScrollBarStyle(mScrollbarStyle); } }
Example 8
Source File: PreferenceDialogFragment.java From meatspace-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); if (b != null) xmlId = b.getInt("xml"); mPreferenceManager = onCreatePreferenceManager(); lv = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.fragment_settings, null); lv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); addPreferencesFromResource(xmlId); postBindPreferences(); if (onPreferenceAttachedListener != null) { onPreferenceAttachedListener.onPreferenceAttached(getPreferenceScreen(), xmlId); } }
Example 9
Source File: AppListFragment.java From effective_android_sample with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); PackageManager packageManager = getActivity().getPackageManager(); List<PackageInfo> packageInfoList = packageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES); CardListAdapter adapter = new CardListAdapter(getActivity()); if (packageInfoList != null) { for (PackageInfo info : packageInfoList) { adapter.add(info); } } int padding = (int) (getResources().getDisplayMetrics().density * 8); // 8dip ListView listView = getListView(); listView.setPadding(padding, 0, padding, 0); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setDivider(null); LayoutInflater inflater = LayoutInflater.from(getActivity()); View header = inflater.inflate(R.layout.list_header_footer, listView, false); View footer = inflater.inflate(R.layout.list_header_footer, listView, false); listView.addHeaderView(header, null, false); listView.addFooterView(footer, null, false); setListAdapter(adapter); }