List of usage examples for android.view View SCROLLBARS_INSIDE_INSET
int SCROLLBARS_INSIDE_INSET
To view the source code for android.view View SCROLLBARS_INSIDE_INSET.
Click Source Link
From source file:com.onyx.deskclock.deskclock.worldclock.CitySelectionActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setVolumeControlStream(AudioManager.STREAM_ALARM); setContentView(R.layout.cities_activity); RelativeLayout relativeLayout_back = (RelativeLayout) findViewById(R.id.back_function_layout); relativeLayout_back.setOnClickListener(new View.OnClickListener() { @Override//from w w w .j a v a2s . c o m public void onClick(View v) { finish(); } }); Toolbar toolbar = (Toolbar) findViewById(R.id.alarm_toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } mSearchMenuItemController = new SearchMenuItemController(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String query) { mCitiesAdapter.filter(query); updateFastScrolling(); return true; } }, savedInstanceState); mCitiesAdapter = new CityAdapter(this, mSearchMenuItemController); mActionBarMenuManager.addMenuItemController(new NavUpMenuItemController(this)) .addMenuItemController(mSearchMenuItemController) .addMenuItemController(new SortOrderMenuItemController()) .addMenuItemController(new SettingMenuItemController(this)) .addMenuItemController(MenuItemControllerFactory.getInstance().buildMenuItemControllers(this)); mCitiesList = (ListView) findViewById(R.id.cities_list); mCitiesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); mCitiesList.setAdapter(mCitiesAdapter); updateFastScrolling(); }
From source file:com.audiokernel.euphonyrmt.fragments.BrowseFragment.java
/** * This is required because setting the fast scroll prior to KitKat was * important because of a bug. This bug has since been corrected, but the * opposite order is now required or the fast scroll will not show. * * @param shouldShowFastScroll If the fast scroll should be shown or not *///from w ww . j a v a 2s .c om protected void refreshFastScrollStyle(final boolean shouldShowFastScroll) { if (shouldShowFastScroll) { refreshFastScrollStyle(View.SCROLLBARS_INSIDE_INSET, true); } else { refreshFastScrollStyle(View.SCROLLBARS_INSIDE_OVERLAY, false); } }
From source file:android.webkit.cts.WebViewTest.java
@UiThreadTest public void testSetScrollBarStyle() { if (!NullWebViewUtils.isWebViewAvailable()) { return;//from ww w . j a va 2s . co m } mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); assertFalse(mWebView.overlayHorizontalScrollbar()); assertFalse(mWebView.overlayVerticalScrollbar()); mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); assertTrue(mWebView.overlayHorizontalScrollbar()); assertTrue(mWebView.overlayVerticalScrollbar()); mWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET); assertFalse(mWebView.overlayHorizontalScrollbar()); assertFalse(mWebView.overlayVerticalScrollbar()); mWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); assertTrue(mWebView.overlayHorizontalScrollbar()); assertTrue(mWebView.overlayVerticalScrollbar()); }
From source file:com.android.deskclock.worldclock.CitiesActivity.java
private void updateLayout() { setContentView(R.layout.cities_activity); mCitiesList = (ListView) findViewById(R.id.cities_list); setFastScroll(TextUtils.isEmpty(mQueryTextBuffer.toString().trim())); mCitiesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); mUserSelectedCities = Cities.readCitiesFromSharedPrefs(PreferenceManager.getDefaultSharedPreferences(this)); mAdapter = new CityAdapter(this, mFactory); mCitiesList.setAdapter(mAdapter);//from w ww . j av a 2 s. c o m }
From source file:com.audiokernel.euphonyrmt.fragments.QueueFragment.java
/** * Updates the scrollbar./* w w w . java 2 s.c o m*/ * * @param newSongList The updated list of songs for the playlist. * @param listPlayingID The current playing playlist id. */ protected void updateScrollbar(final ArrayList newSongList, final int listPlayingID) { mActivity.runOnUiThread(new Runnable() { /** * This is a helper method to workaround shortcomings of the fast scroll API. * * @param scrollbarStyle The {@code View} scrollbar style. * @param isAlwaysVisible The visibility of the scrollbar. */ private void refreshFastScrollStyle(final int scrollbarStyle, final boolean isAlwaysVisible) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mList.setFastScrollAlwaysVisible(isAlwaysVisible); mList.setScrollBarStyle(scrollbarStyle); } else { mList.setScrollBarStyle(scrollbarStyle); mList.setFastScrollAlwaysVisible(isAlwaysVisible); } } @Override public void run() { final int firstVisibleElementIndex = mList.getFirstVisiblePosition(); final View firstVisibleItem = mList.getChildAt(0); final int firstVisiblePosition; final ArrayAdapter songs = new QueueAdapter(mActivity, R.layout.playlist_queue_item, newSongList); if (firstVisibleItem != null) { firstVisiblePosition = firstVisibleItem.getTop(); } else { firstVisiblePosition = 0; } setListAdapter(songs); mSongList = newSongList; songs.notifyDataSetChanged(); /** * Note : Setting the scrollbar style before setting the fast scroll state is very * important pre-KitKat, because of a bug. It is also very important post-KitKat * because it needs the opposite order or it won't show the FastScroll. * * This is so stupid I don't even .... argh. */ if (newSongList.size() >= MIN_SONGS_BEFORE_FASTSCROLL) { refreshFastScrollStyle(View.SCROLLBARS_INSIDE_INSET, true); } else { refreshFastScrollStyle(View.SCROLLBARS_INSIDE_OVERLAY, false); } if (mActionMode != null) { mActionMode.finish(); } // Restore the scroll bar position if (firstVisibleElementIndex == 0 || firstVisiblePosition == 0) { /** * Only scroll if there is a valid song to scroll to. 0 is a valid song but * does not require scroll anyway. Also, only scroll if it's the first update. * You don't want your playlist to scroll itself while you are looking at other * stuff. */ if (listPlayingID > 0 && getView() != null) { setSelection(listPlayingID); } } else { mList.setSelectionFromTop(firstVisibleElementIndex, firstVisiblePosition); } } }); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
@SuppressLint("NewApi") final private void aboutTaskAutomation() { // common ??// ww w. jav a 2 s .co m final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.about_dialog); ((TextView) dialog.findViewById(R.id.about_dialog_title)) .setText(getString(R.string.msgs_about_dlg_title) + " Ver " + getApplVersionName()); final WebView func_view = (WebView) dialog.findViewById(R.id.about_dialog_function); // func_view.setWebViewClient(new WebViewClient()); // func_view.getSettings().setJavaScriptEnabled(true); func_view.getSettings().setSupportZoom(true); // func_view.setVerticalScrollbarOverlay(true); func_view.setBackgroundColor(Color.LTGRAY); // func_view.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); func_view.setVerticalScrollBarEnabled(true); func_view.setScrollbarFadingEnabled(false); if (Build.VERSION.SDK_INT > 10) { func_view.getSettings().setDisplayZoomControls(true); func_view.getSettings().setBuiltInZoomControls(true); } else { func_view.getSettings().setBuiltInZoomControls(true); } func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_about_dlg_func_html)); final WebView change_view = (WebView) dialog.findViewById(R.id.about_dialog_change_history); if (Build.VERSION.SDK_INT > 10) { func_view.getSettings().setDisplayZoomControls(true); func_view.getSettings().setBuiltInZoomControls(true); } else { func_view.getSettings().setBuiltInZoomControls(true); } change_view.loadDataWithBaseURL("file:///android_asset/", getString(R.string.msgs_about_dlg_change_desc), "text/html", "UTF-8", ""); change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); change_view.getSettings().setSupportZoom(true); if (Build.VERSION.SDK_INT > 10) { change_view.getSettings().setDisplayZoomControls(true); change_view.getSettings().setBuiltInZoomControls(true); } else { change_view.getSettings().setBuiltInZoomControls(true); } final Button btnFunc = (Button) dialog.findViewById(R.id.about_dialog_btn_show_func); final Button btnChange = (Button) dialog.findViewById(R.id.about_dialog_btn_show_change); final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok); func_view.setVisibility(TextView.VISIBLE); change_view.setVisibility(TextView.GONE); btnChange.setBackgroundResource(R.drawable.button_back_ground_color_selector); btnFunc.setBackgroundResource(R.drawable.button_back_ground_color_selector); btnChange.setTextColor(Color.DKGRAY); btnFunc.setTextColor(Color.GREEN); btnFunc.setEnabled(false); CommonDialog.setDlgBoxSizeLimit(dialog, true); // func? btnFunc.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { change_view.setVisibility(TextView.GONE); func_view.setVisibility(TextView.VISIBLE); CommonDialog.setDlgBoxSizeLimit(dialog, true); btnFunc.setTextColor(Color.GREEN); btnChange.setTextColor(Color.DKGRAY); btnChange.setEnabled(true); btnFunc.setEnabled(false); } }); // change? btnChange.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { change_view.setVisibility(TextView.VISIBLE); func_view.setVisibility(TextView.GONE); CommonDialog.setDlgBoxSizeLimit(dialog, true); btnChange.setTextColor(Color.GREEN); btnFunc.setTextColor(Color.DKGRAY); btnChange.setEnabled(false); btnFunc.setEnabled(true); } }); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }