Java Code Examples for android.widget.listview#setCacheColorHint()
The following examples show how to use
android.widget.listview#setCacheColorHint() .
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: PluginSettingsDialog.java From xposed-rimet with Apache License 2.0 | 6 votes |
@Override protected View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { // 不显示默认标题 getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); mCommonFrameLayout = new CommonFrameLayout(getContext()); mToolbar = mCommonFrameLayout.getTitleView(); mMoreButton = mToolbar.addMoreImageButton(); LinearLayout content = LayoutUtil.newCommonLayout(getContext()); mListView = new ListView(getContext()); mListView.setCacheColorHint(0x00000000); mListView.setDividerHeight(0); mListView.setLayoutParams(LayoutUtil.newMatchFrameLayoutParams()); content.addView(mListView); mCommonFrameLayout.setContent(content); return mCommonFrameLayout; }
Example 2
Source File: SimpleHomeActivity.java From Android-skin-support with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ListView lv = new ListView(mContext); lv.setCacheColorHint(Color.TRANSPARENT); lv.setFadingEdgeLength(0); lv.setAdapter(new SimpleHomeAdapter(mContext, mItems)); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(mContext, mClasses[position]); startActivity(intent); } }); setContentView(lv); }
Example 3
Source File: PopupHomeActivity.java From FlycoDialog_Master with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDisplayMetrics = getResources().getDisplayMetrics(); ListView lv = new ListView(mContext); lv.setCacheColorHint(Color.TRANSPARENT); lv.setBackgroundColor(Color.WHITE); lv.setFadingEdgeLength(0); lv.setAdapter(new SimpleHomeAdapter()); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(mContext, mClazzs[position]); startActivity(intent); } }); setContentView(lv); }
Example 4
Source File: SimpleHomeActivity.java From FlycoTabLayout with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ListView lv = new ListView(mContext); lv.setCacheColorHint(Color.TRANSPARENT); lv.setFadingEdgeLength(0); lv.setAdapter(new SimpleHomeAdapter(mContext, mItems)); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(mContext, mClasses[position]); startActivity(intent); } }); setContentView(lv); }
Example 5
Source File: SettingsActivity.java From buddycloud-android with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") protected void showPreferences() { ListView lv = getListView(); if (lv != null) { lv.setBackgroundColor(this.getResources().getColor(R.color.bc_bg_color)); lv.setCacheColorHint(this.getResources().getColor(R.color.bc_bg_color)); lv.setSelector(R.drawable.setting_pref_item_background_selector); ColorDrawable dividerDrawable = new ColorDrawable(this.getResources().getColor(R.color.bc_green_blue_color)); lv.setDivider(dividerDrawable); lv.setDividerHeight(1); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { addPreferencesFromResource(R.xml.preferences); } else { loadSettingsFragment(); } }
Example 6
Source File: UIHelper.java From iSCAU-Android with GNU General Public License v3.0 | 5 votes |
/** * help to build ClassTableListView * @param ctx * @return */ public static ListView buildClassListView(Context ctx){ ListView classListView = new ListView(ctx); classListView.setBackgroundColor(0); classListView.setCacheColorHint(0); classListView.setDividerHeight(0); return classListView; }
Example 7
Source File: SettingActivity.java From qingyang with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 添加Activity到堆栈 AppManager.getAppManager().addActivity(this); myApplication = (BaseApplication) getApplication(); // 设置显示Preferences addPreferencesFromResource(R.xml.preferences); // 获得SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(this); ListView localListView = getListView(); localListView.setBackgroundColor(0); localListView.setCacheColorHint(0); ((ViewGroup) localListView.getParent()).removeView(localListView); ViewGroup localViewGroup = (ViewGroup) getLayoutInflater().inflate( R.layout.setting_activity, null); ((ViewGroup) localViewGroup.findViewById(R.id.setting_content)) .addView(localListView, -1, -1); setContentView(localViewGroup); initView(); }
Example 8
Source File: RememberEditText.java From RememberEditText with Apache License 2.0 | 5 votes |
private void willShowPopupWindow() { int userCount = mListAdapter.getCount(); if (userCount > mRememberCount) { userCount = mRememberCount; } int itemHeight = getResources().getDimensionPixelSize(R.dimen.remember_item_height); mPopupWindowHeight = itemHeight * userCount + (userCount - 1); if (pop == null) { mCacheListView = new ListView(getContext()); mCacheListView.setCacheColorHint(0); mCacheListView.setScrollingCacheEnabled(false); mCacheListView.setFadingEdgeLength(0); mCacheListView.setDivider(new ColorDrawable(Color.GRAY)); mCacheListView.setDividerHeight(1); LayoutParams params = new LayoutParams(getWidth(), mPopupWindowHeight); mCacheListView.setLayoutParams(params); mCacheListWrapperLinearLayout = new LinearLayout(getContext()); mCacheListWrapperLinearLayout.setLayoutParams(params); mCacheListWrapperLinearLayout.addView(mCacheListView); pop = new SafePopupWindow(mCacheListWrapperLinearLayout, getWidth(), LayoutParams.WRAP_CONTENT); mCacheListView.setAdapter(mListAdapter); } pop.setAnimationStyle(R.style.RememberEditTextPopupWindowAnim); pop.showAsDropDown(this); mListAdapter.notifyDataSetChanged(); mIconStatus = ICON_SHOW_DROP_UP; }
Example 9
Source File: TitlesFragment.java From androidtestdebug with MIT License | 5 votes |
@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"); } 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); }
Example 10
Source File: PullToRefreshListView.java From Roid-Library with Apache License 2.0 | 5 votes |
@Override protected ListView createRefreshableView(Context context, AttributeSet attrs) { ListView lv = createListView(context, attrs); lv.setScrollingCacheEnabled(false); lv.setFadingEdgeLength(0); lv.setDivider(new ColorDrawable(Color.LTGRAY)); lv.setCacheColorHint(Color.TRANSPARENT); // Set it to this so it can be used in ListActivity/ListFragment lv.setId(android.R.id.list); return lv; }
Example 11
Source File: NormalListDialog.java From FlycoDialog_Master with MIT License | 5 votes |
@Override public View onCreateView() { LinearLayout ll_container = new LinearLayout(mContext); ll_container.setOrientation(LinearLayout.VERTICAL); /** title */ mTvTitle = new TextView(mContext); mTvTitle.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); mTvTitle.setSingleLine(true); mTvTitle.setPadding(dp2px(18), dp2px(10), 0, dp2px(10)); ll_container.addView(mTvTitle); /** listview */ mLv = new ListView(mContext); mLv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); mLv.setCacheColorHint(Color.TRANSPARENT); mLv.setFadingEdgeLength(0); mLv.setVerticalScrollBarEnabled(false); mLv.setSelector(new ColorDrawable(Color.TRANSPARENT)); ll_container.addView(mLv); return ll_container; }
Example 12
Source File: TitlesFragment.java From androidtestdebug with MIT License | 5 votes |
@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"); } populateTitles(mCategory); ListView lv = getListView(); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); lv.setCacheColorHint(Color.TRANSPARENT); lv.setOnItemLongClickListener(new OnItemLongClickListener() { @SuppressLint("DefaultLocale") 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); }
Example 13
Source File: TitlesFragment.java From androidtestdebug with MIT License | 5 votes |
@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"); } 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); }
Example 14
Source File: SuperDialog.java From SuperDialog with Apache License 2.0 | 5 votes |
/** * 列表显示,显示列表屏蔽按钮 */ private void initListView(ViewGroup viewRoot) { listView = new ListView(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.setMargins(dp2px(15), dp2px(5), dp2px(15), dp2px(5)); listView.setLayoutParams(layoutParams); listView.setCacheColorHint(Color.TRANSPARENT); listView.setFadingEdgeLength(0); listView.setVerticalScrollBarEnabled(false); listView.setSelector(new ColorDrawable(Color.TRANSPARENT)); listView.setDivider(new ColorDrawable(Color.LTGRAY)); listView.setDividerHeight(dp2px(0.8f)); if (dialogAdapter == null) { dialogAdapter = new ListDialogAdapter(); } listView.setAdapter(dialogAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { dismiss(); if (listener != null) { listener.click(false, position); } } }); listView.setLayoutAnimation(getLayoutAnimation()); viewRoot.addView(listView); }
Example 15
Source File: ActionSheetDialog.java From FlycoDialog_Master with MIT License | 4 votes |
@Override public View onCreateView() { LinearLayout ll_container = new LinearLayout(mContext); ll_container.setOrientation(LinearLayout.VERTICAL); ll_container.setBackgroundColor(Color.TRANSPARENT); /** title */ mTvTitle = new TextView(mContext); mTvTitle.setGravity(Gravity.CENTER); mTvTitle.setPadding(dp2px(10), dp2px(5), dp2px(10), dp2px(5)); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.topMargin = dp2px(20); ll_container.addView(mTvTitle, params); /** title underline */ mVLineTitle = new View(mContext); ll_container.addView(mVLineTitle); /** listview */ mLv = new ListView(mContext); mLv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1)); mLv.setCacheColorHint(Color.TRANSPARENT); mLv.setFadingEdgeLength(0); mLv.setVerticalScrollBarEnabled(false); mLv.setSelector(new ColorDrawable(Color.TRANSPARENT)); ll_container.addView(mLv); /** mCancel btn */ mTvCancel = new TextView(mContext); mTvCancel.setGravity(Gravity.CENTER); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.topMargin = dp2px(7); lp.bottomMargin = dp2px(7); mTvCancel.setLayoutParams(lp); ll_container.addView(mTvCancel); return ll_container; }
Example 16
Source File: ActionSheetDialog.java From SprintNBA with Apache License 2.0 | 4 votes |
@Override public View onCreateView() { LinearLayout ll_container = new LinearLayout(mContext); ll_container.setOrientation(LinearLayout.VERTICAL); ll_container.setBackgroundColor(Color.TRANSPARENT); /** title */ mTvTitle = new TextView(mContext); mTvTitle.setGravity(Gravity.CENTER); mTvTitle.setPadding(dp2px(10), dp2px(5), dp2px(10), dp2px(5)); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.topMargin = dp2px(20); ll_container.addView(mTvTitle, params); /** title underline */ mVLineTitle = new View(mContext); ll_container.addView(mVLineTitle); /** listview */ mLv = new ListView(mContext); mLv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1)); mLv.setCacheColorHint(Color.TRANSPARENT); mLv.setFadingEdgeLength(0); mLv.setVerticalScrollBarEnabled(false); mLv.setSelector(new ColorDrawable(Color.TRANSPARENT)); ll_container.addView(mLv); /** mCancel btn */ mTvCancel = new TextView(mContext); mTvCancel.setGravity(Gravity.CENTER); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.topMargin = dp2px(7); lp.bottomMargin = dp2px(7); mTvCancel.setLayoutParams(lp); ll_container.addView(mTvCancel); return ll_container; }
Example 17
Source File: ActionSheetDialog.java From RecordVideo with Apache License 2.0 | 4 votes |
@Override public View onCreateView() { LinearLayout ll_container = new LinearLayout(mContext); ll_container.setOrientation(LinearLayout.VERTICAL); ll_container.setBackgroundColor(Color.TRANSPARENT); /** title */ mTvTitle = new TextView(mContext); mTvTitle.setGravity(Gravity.CENTER); mTvTitle.setPadding(dp2px(10), dp2px(5), dp2px(10), dp2px(5)); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.topMargin = dp2px(20); ll_container.addView(mTvTitle, params); /** title underline */ mVLineTitle = new View(mContext); ll_container.addView(mVLineTitle); /** listview */ mLv = new ListView(mContext); mLv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1)); mLv.setCacheColorHint(Color.TRANSPARENT); mLv.setFadingEdgeLength(0); mLv.setVerticalScrollBarEnabled(false); mLv.setSelector(new ColorDrawable(Color.TRANSPARENT)); ll_container.addView(mLv); TextView cancelDivider = new TextView(mContext); cancelDivider.setGravity(Gravity.CENTER); cancelDivider.setBackgroundColor(Color.parseColor("#ffefefef")); LayoutParams clp = new LayoutParams(LayoutParams.MATCH_PARENT, 20); cancelDivider.setLayoutParams(clp); ll_container.addView(cancelDivider); /** mCancel btn */ mTvCancel = new TextView(mContext); mTvCancel.setGravity(Gravity.CENTER); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.topMargin = dp2px(0); lp.bottomMargin = dp2px(0); mTvCancel.setLayoutParams(lp); ll_container.addView(mTvCancel); return ll_container; }
Example 18
Source File: AccountFiltersListFragment.java From CSipSimple with GNU General Public License v3.0 | 4 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); //getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckFilterId = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); } setListShown(false); if(mAdapter == null) { if(mHeaderView != null) { lv.addHeaderView(mHeaderView , null, true); } mAdapter = new AccountFiltersListAdapter(getActivity(), null); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); }else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
Example 19
Source File: AccountsEditListFragment.java From CSipSimple with GNU General Public License v3.0 | 4 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); //getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); } setListShown(false); if(mAdapter == null) { if(mHeaderView != null) { lv.addHeaderView(mHeaderView , null, true); } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); }else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
Example 20
Source File: ActionSheetDialog.java From AutoTest with MIT License | 4 votes |
@Override public View onCreateView() { LinearLayout ll_container = new LinearLayout(mContext); ll_container.setOrientation(LinearLayout.VERTICAL); ll_container.setBackgroundColor(Color.TRANSPARENT); /** title */ mTvTitle = new TextView(mContext); mTvTitle.setGravity(Gravity.CENTER); mTvTitle.setPadding(dp2px(10), dp2px(5), dp2px(10), dp2px(5)); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.topMargin = dp2px(20); ll_container.addView(mTvTitle, params); /** title underline */ mVLineTitle = new View(mContext); ll_container.addView(mVLineTitle); /** listview */ mLv = new ListView(mContext); mLv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1)); mLv.setCacheColorHint(Color.TRANSPARENT); mLv.setFadingEdgeLength(0); mLv.setVerticalScrollBarEnabled(false); mLv.setSelector(new ColorDrawable(Color.TRANSPARENT)); ll_container.addView(mLv); /** mCancel btn */ mTvCancel = new TextView(mContext); mTvCancel.setGravity(Gravity.CENTER); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.topMargin = dp2px(7); lp.bottomMargin = dp2px(7); mTvCancel.setLayoutParams(lp); ll_container.addView(mTvCancel); return ll_container; }