List of usage examples for android.content Context obtainStyledAttributes
public final TypedArray obtainStyledAttributes(AttributeSet set, @StyleableRes int[] attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes)
From source file:com.android.zlauncher.CellLayout.java
public CellLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // A ViewGroup usually does not draw, but CellLayout needs to draw a rectangle to show // the user where a dragged item will land when dropped. setWillNotDraw(false);/* w w w . ja va 2s.com*/ setClipToPadding(false); mLauncher = (Launcher) context; DeviceProfile grid = mLauncher.getDeviceProfile(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0); mCellWidth = mCellHeight = -1; mFixedCellWidth = mFixedCellHeight = -1; mWidthGap = mOriginalWidthGap = 0; mHeightGap = mOriginalHeightGap = 0; mMaxGap = Integer.MAX_VALUE; mCountX = (int) grid.inv.numColumns; mCountY = (int) grid.inv.numRows; mOccupied = new boolean[mCountX][mCountY]; mTmpOccupied = new boolean[mCountX][mCountY]; mPreviousReorderDirection[0] = INVALID_DIRECTION; mPreviousReorderDirection[1] = INVALID_DIRECTION; a.recycle(); setAlwaysDrawnWithCacheEnabled(false); final Resources res = getResources(); mHotseatScale = (float) grid.hotseatIconSizePx / grid.iconSizePx; mBackground = (TransitionDrawable) res.getDrawable(R.drawable.bg_screenpanel); mBackground.setCallback(this); mBackground.setAlpha((int) (mBackgroundAlpha * 255)); mReorderPreviewAnimationMagnitude = (REORDER_PREVIEW_MAGNITUDE * grid.iconSizePx); // Initialize the data structures used for the drag visualization. mEaseOutInterpolator = new DecelerateInterpolator(2.5f); // Quint ease out mDragCell[0] = mDragCell[1] = -1; for (int i = 0; i < mDragOutlines.length; i++) { mDragOutlines[i] = new Rect(-1, -1, -1, -1); } // When dragging things around the home screens, we show a green outline of // where the item will land. The outlines gradually fade out, leaving a trail // behind the drag path. // Set up all the animations that are used to implement this fading. final int duration = res.getInteger(R.integer.config_dragOutlineFadeTime); final float fromAlphaValue = 0; final float toAlphaValue = (float) res.getInteger(R.integer.config_dragOutlineMaxAlpha); Arrays.fill(mDragOutlineAlphas, fromAlphaValue); for (int i = 0; i < mDragOutlineAnims.length; i++) { final InterruptibleInOutAnimator anim = new InterruptibleInOutAnimator(this, duration, fromAlphaValue, toAlphaValue); anim.getAnimator().setInterpolator(mEaseOutInterpolator); final int thisIndex = i; anim.getAnimator().addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { final Bitmap outline = (Bitmap) anim.getTag(); // If an animation is started and then stopped very quickly, we can still // get spurious updates we've cleared the tag. Guard against this. if (outline == null) { @SuppressWarnings("all") // suppress dead code warning final boolean debug = false; if (debug) { Object val = animation.getAnimatedValue(); Log.d(TAG, "anim " + thisIndex + " update: " + val + ", isStopped " + anim.isStopped()); } // Try to prevent it from continuing to run animation.cancel(); } else { mDragOutlineAlphas[thisIndex] = (Float) animation.getAnimatedValue(); CellLayout.this.invalidate(mDragOutlines[thisIndex]); } } }); // The animation holds a reference to the drag outline bitmap as long is it's // running. This way the bitmap can be GCed when the animations are complete. anim.getAnimator().addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if ((Float) ((ValueAnimator) animation).getAnimatedValue() == 0f) { anim.setTag(null); } } }); mDragOutlineAnims[i] = anim; } mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context); mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap, mCountX, mCountY); mStylusEventHelper = new StylusEventHelper(this); /* mTouchFeedbackView = new ClickShadowView(context); addView(mTouchFeedbackView);*/ addView(mShortcutsAndWidgets); }
From source file:com.android.leanlauncher.CellLayout.java
public CellLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mDragEnforcer = new DropTarget.DragEnforcer(context); // A ViewGroup usually does not draw, but CellLayout needs to draw a rectangle to show // the user where a dragged item will land when dropped. setWillNotDraw(false);// w w w. j a va2 s.c o m setClipToPadding(false); mLauncher = (Launcher) context; LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0); mCellWidth = mCellHeight = -1; mFixedCellWidth = mFixedCellHeight = -1; mWidthGap = mOriginalWidthGap = 0; mHeightGap = mOriginalHeightGap = 0; mMaxGap = Integer.MAX_VALUE; mCountX = (int) grid.numColumns; mCountY = (int) grid.numRows; mOccupied = new boolean[mCountX][mCountY]; mTmpOccupied = new boolean[mCountX][mCountY]; mPreviousReorderDirection[0] = INVALID_DIRECTION; mPreviousReorderDirection[1] = INVALID_DIRECTION; a.recycle(); setAlwaysDrawnWithCacheEnabled(false); final Resources res = getResources(); mNormalBackground = res.getDrawable(R.drawable.screenpanel); mActiveGlowBackground = res.getDrawable(R.drawable.screenpanel_hover); mOverScrollLeft = res.getDrawable(R.drawable.overscroll_glow_left); mOverScrollRight = res.getDrawable(R.drawable.overscroll_glow_right); mForegroundPadding = res.getDimensionPixelSize(R.dimen.workspace_overscroll_drawable_padding); mReorderPreviewAnimationMagnitude = (REORDER_PREVIEW_MAGNITUDE * grid.iconSizePx); mNormalBackground.setFilterBitmap(true); mActiveGlowBackground.setFilterBitmap(true); // Initialize the data structures used for the drag visualization. TimeInterpolator easeOutInterpolator = new DecelerateInterpolator(2.5f); mDragCell[0] = mDragCell[1] = -1; for (int i = 0; i < mDragOutlines.length; i++) { mDragOutlines[i] = new Rect(-1, -1, -1, -1); } // When dragging things around the home screens, we show a green outline of // where the item will land. The outlines gradually fade out, leaving a trail // behind the drag path. // Set up all the animations that are used to implement this fading. final int duration = res.getInteger(R.integer.config_dragOutlineFadeTime); final float fromAlphaValue = 0; final float toAlphaValue = (float) res.getInteger(R.integer.config_dragOutlineMaxAlpha); Arrays.fill(mDragOutlineAlphas, fromAlphaValue); for (int i = 0; i < mDragOutlineAnims.length; i++) { final InterruptibleInOutAnimator anim = new InterruptibleInOutAnimator(this, duration, fromAlphaValue, toAlphaValue); anim.getAnimator().setInterpolator(easeOutInterpolator); final int thisIndex = i; anim.getAnimator().addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { final Bitmap outline = (Bitmap) anim.getTag(); // If an animation is started and then stopped very quickly, we can still // get spurious updates we've cleared the tag. Guard against this. if (outline == null) { @SuppressWarnings("all") // suppress dead code warning final boolean debug = false; if (debug) { Object val = animation.getAnimatedValue(); Log.d(TAG, "anim " + thisIndex + " update: " + val + ", isStopped " + anim.isStopped()); } // Try to prevent it from continuing to run animation.cancel(); } else { mDragOutlineAlphas[thisIndex] = (Float) animation.getAnimatedValue(); CellLayout.this.invalidate(mDragOutlines[thisIndex]); } } }); // The animation holds a reference to the drag outline bitmap as long is it's // running. This way the bitmap can be GCed when the animations are complete. anim.getAnimator().addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if ((Float) ((ValueAnimator) animation).getAnimatedValue() == 0f) { anim.setTag(null); } } }); mDragOutlineAnims[i] = anim; } mBackgroundRect = new Rect(); mForegroundRect = new Rect(); mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context); mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap, mCountX, mCountY); mTouchFeedbackView = new FastBitmapView(context); // Make the feedback view large enough to hold the blur bitmap. addView(mTouchFeedbackView, (int) (grid.cellWidthPx * 1.2), (int) (grid.cellHeightPx * 1.2)); addView(mShortcutsAndWidgets); }
From source file:com.appunite.list.HorizontalListView.java
public HorizontalListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListView, defStyle, 0); CharSequence[] entries = a.getTextArray(R.styleable.ListView_android_entries); if (entries != null) { setAdapter(new ArrayAdapter<CharSequence>(context, android.R.layout.simple_list_item_1, entries)); }//from w w w . j a va 2s. co m final Drawable d = a.getDrawable(R.styleable.ListView_android_divider); if (d != null) { // If a divider is specified use its intrinsic width for divider width setDivider(d); } final Drawable osHeader = a.getDrawable(R.styleable.ListView_overScrollHeader); if (osHeader != null) { setOverscrollHeader(osHeader); } final Drawable osFooter = a.getDrawable(R.styleable.ListView_overScrollFooter); if (osFooter != null) { setOverscrollFooter(osFooter); } // Use the width specified, zero being the default final int dividerHeight = a.getDimensionPixelSize(R.styleable.ListView_android_dividerHeight, 0); if (dividerHeight != 0) { setDividerWidth(dividerHeight); } mHeaderDividersEnabled = a.getBoolean(R.styleable.ListView_headerDividersEnabled, true); mFooterDividersEnabled = a.getBoolean(R.styleable.ListView_footerDividersEnabled, true); a.recycle(); }
From source file:com.appunite.list.ListView.java
public ListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListView, defStyle, 0); CharSequence[] entries = a.getTextArray(R.styleable.ListView_android_entries); if (entries != null) { setAdapter(new ArrayAdapter<CharSequence>(context, android.R.layout.simple_list_item_1, entries)); }//from w ww . j a v a 2 s .c o m final Drawable d = a.getDrawable(R.styleable.ListView_android_divider); if (d != null) { // If a divider is specified use its intrinsic width for divider width setDivider(d); } final Drawable osHeader = a.getDrawable(R.styleable.ListView_overScrollHeader); if (osHeader != null) { setOverscrollHeader(osHeader); } final Drawable osFooter = a.getDrawable(R.styleable.ListView_overScrollFooter); if (osFooter != null) { setOverscrollFooter(osFooter); } // Use the width specified, zero being the default final int dividerHeight = a.getDimensionPixelSize(R.styleable.ListView_android_dividerHeight, 0); if (dividerHeight != 0) { setDividerHeight(dividerHeight); } mHeaderDividersEnabled = a.getBoolean(R.styleable.ListView_headerDividersEnabled, true); mFooterDividersEnabled = a.getBoolean(R.styleable.ListView_footerDividersEnabled, true); a.recycle(); }
From source file:cm.aptoide.com.actionbarsherlock.widget.SearchView.java
public SearchView(Context context, AttributeSet attrs) { super(context, attrs); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) { throw new IllegalStateException("SearchView is API 8+ only."); }//from w w w. j av a2s . co m LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.abs__search_view, this, true); mSearchButton = findViewById(R.id.abs__search_button); mQueryTextView = (SearchAutoComplete) findViewById(R.id.abs__search_src_text); mQueryTextView.setSearchView(this); mSearchEditFrame = findViewById(R.id.abs__search_edit_frame); mSearchPlate = findViewById(R.id.abs__search_plate); mSubmitArea = findViewById(R.id.abs__submit_area); mSubmitButton = findViewById(R.id.abs__search_go_btn); mCloseButton = (ImageView) findViewById(R.id.abs__search_close_btn); mVoiceButton = findViewById(R.id.abs__search_voice_btn); mSearchHintIcon = (ImageView) findViewById(R.id.abs__search_mag_icon); mSearchButton.setOnClickListener(mOnClickListener); mCloseButton.setOnClickListener(mOnClickListener); mSubmitButton.setOnClickListener(mOnClickListener); mVoiceButton.setOnClickListener(mOnClickListener); mQueryTextView.setOnClickListener(mOnClickListener); mQueryTextView.addTextChangedListener(mTextWatcher); mQueryTextView.setOnEditorActionListener(mOnEditorActionListener); mQueryTextView.setOnItemClickListener(mOnItemClickListener); mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener); mQueryTextView.setOnKeyListener(mTextKeyListener); // Inform any listener of focus changes mQueryTextView.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (mOnQueryTextFocusChangeListener != null) { mOnQueryTextFocusChangeListener.onFocusChange(SearchView.this, hasFocus); } } }); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SherlockSearchView, 0, 0); setIconifiedByDefault(a.getBoolean(R.styleable.SherlockSearchView_iconifiedByDefault, true)); int maxWidth = a.getDimensionPixelSize(R.styleable.SherlockSearchView_android_maxWidth, -1); if (maxWidth != -1) { setMaxWidth(maxWidth); } CharSequence queryHint = a.getText(R.styleable.SherlockSearchView_queryHint); if (!TextUtils.isEmpty(queryHint)) { setQueryHint(queryHint); } int imeOptions = a.getInt(R.styleable.SherlockSearchView_android_imeOptions, -1); if (imeOptions != -1) { setImeOptions(imeOptions); } int inputType = a.getInt(R.styleable.SherlockSearchView_android_inputType, -1); if (inputType != -1) { setInputType(inputType); } a.recycle(); boolean focusable = true; a = context.obtainStyledAttributes(attrs, R.styleable.SherlockView, 0, 0); focusable = a.getBoolean(R.styleable.SherlockView_android_focusable, focusable); a.recycle(); setFocusable(focusable); // Save voice intent for later queries/launching mVoiceWebSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH); mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mDropDownAnchor = findViewById(mQueryTextView.getDropDownAnchor()); if (mDropDownAnchor != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mDropDownAnchor.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { adjustDropDownSizeAndPosition(); } }); } else { mDropDownAnchor.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { adjustDropDownSizeAndPosition(); } }); } } updateViewsVisibility(mIconifiedByDefault); updateQueryHint(); }
From source file:com.android.launcher2.Workspace.java
/** * Used to inflate the Workspace from XML. * * @param context The application's context. * @param attrs The attributes set containing the Workspace's customization values. * @param defStyle Unused.//from w ww. j av a2s. c om */ public Workspace(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mContentIsRefreshable = false; mOriginalPageSpacing = mPageSpacing; mDragEnforcer = new DropTarget.DragEnforcer(context); // With workspace, data is available straight from the get-go setDataIsReady(); mLauncher = (Launcher) context; final Resources res = getResources(); mWorkspaceFadeInAdjacentScreens = res.getBoolean(R.bool.config_workspaceFadeAdjacentScreens); mFadeInAdjacentScreens = false; mWallpaperManager = WallpaperManager.getInstance(context); int cellCountX = DEFAULT_CELL_COUNT_X; int cellCountY = DEFAULT_CELL_COUNT_Y; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Workspace, defStyle, 0); if (LauncherApplication.isScreenLarge()) { // Determine number of rows/columns dynamically // TODO: This code currently fails on tablets with an aspect ratio < 1.3. // Around that ratio we should make cells the same size in portrait and // landscape TypedArray actionBarSizeTypedArray = context .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize }); final float actionBarHeight = actionBarSizeTypedArray.getDimension(0, 0f); Point minDims = new Point(); Point maxDims = new Point(); DisplayCompt.getCurrentSizeRange(mLauncher.getWindowManager().getDefaultDisplay(), minDims, maxDims); cellCountX = 1; while (CellLayout.widthInPortrait(res, cellCountX + 1) <= minDims.x) { cellCountX++; } cellCountY = 1; while (actionBarHeight + CellLayout.heightInLandscape(res, cellCountY + 1) <= minDims.y) { cellCountY++; } } mSpringLoadedShrinkFactor = res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f; mSpringLoadedPageSpacing = res.getDimensionPixelSize(R.dimen.workspace_spring_loaded_page_spacing); mCameraDistance = res.getInteger(R.integer.config_cameraDistance); // if the value is manually specified, use that instead cellCountX = a.getInt(R.styleable.Workspace_cellCountX, cellCountX); cellCountY = a.getInt(R.styleable.Workspace_cellCountY, cellCountY); mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1); a.recycle(); setOnHierarchyChangeListener(this); LauncherModel.updateWorkspaceLayoutCells(cellCountX, cellCountY); setHapticFeedbackEnabled(false); initWorkspace(); // Disable multitouch across the workspace/all apps/customize tray setMotionEventSplittingEnabled(true); // Unless otherwise specified this view is important for accessibility. if (ViewCompat.getImportantForAccessibility(this) == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, View.IMPORTANT_FOR_ACCESSIBILITY_YES); } }
From source file:cc.flydev.launcher.Workspace.java
/** * Used to inflate the Workspace from XML. * * @param context The application's context. * @param attrs The attributes set containing the Workspace's customization values. * @param defStyle Unused./*from w w w . j a v a 2 s . c om*/ */ public Workspace(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mContentIsRefreshable = false; mOutlineHelper = HolographicOutlineHelper.obtain(context); mDragEnforcer = new DropTarget.DragEnforcer(context); // With workspace, data is available straight from the get-go setDataIsReady(); mLauncher = (Launcher) context; final Resources res = getResources(); mWorkspaceFadeInAdjacentScreens = res.getBoolean(R.bool.config_workspaceFadeAdjacentScreens); mFadeInAdjacentScreens = false; mWallpaperManager = WallpaperManager.getInstance(context); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Workspace, defStyle, 0); mSpringLoadedShrinkFactor = res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f; mOverviewModeShrinkFactor = res.getInteger(R.integer.config_workspaceOverviewShrinkPercentage) / 100.0f; mOverviewModePageOffset = res.getDimensionPixelSize(R.dimen.overview_mode_page_offset); mCameraDistance = res.getInteger(R.integer.config_cameraDistance); mOriginalDefaultPage = mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1); a.recycle(); setOnHierarchyChangeListener(this); setHapticFeedbackEnabled(false); initWorkspace(); // Disable multitouch across the workspace/all apps/customize tray setMotionEventSplittingEnabled(true); setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); }
From source file:com.android.launcher3.Workspace.java
/** * Used to inflate the Workspace from XML. * * @param context The application's context. * @param attrs The attributes set containing the Workspace's customization values. * @param defStyle Unused./* ww w .j a v a 2s. c om*/ */ public Workspace(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mContentIsRefreshable = false; mOutlineHelper = HolographicOutlineHelper.obtain(context); mDragEnforcer = new DropTarget.DragEnforcer(context); // With workspace, data is available straight from the get-go setDataIsReady(); mLauncher = (Launcher) context; final Resources res = getResources(); mWorkspaceFadeInAdjacentScreens = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile() .shouldFadeAdjacentWorkspaceScreens(); mFadeInAdjacentScreens = false; mWallpaperManager = WallpaperManager.getInstance(context); LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Workspace, defStyle, 0); mSpringLoadedShrinkFactor = res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f; mOverviewModeShrinkFactor = grid.getOverviewModeScale(); mCameraDistance = res.getInteger(R.integer.config_cameraDistance); mOriginalDefaultPage = mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1); a.recycle(); setOnHierarchyChangeListener(this); setHapticFeedbackEnabled(false); initWorkspace(); // Disable multitouch across the workspace/all apps/customize tray setMotionEventSplittingEnabled(true); setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); }
From source file:com.appunite.list.AbsHorizontalListView.java
public AbsHorizontalListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initAbsListView();//from w w w . j av a 2s . c om TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AbsListView, defStyle, 0); Drawable d = a.getDrawable(R.styleable.AbsListView_listSelector); if (d != null) { setSelector(d); } mDrawSelectorOnTop = a.getBoolean(R.styleable.AbsListView_drawSelectorOnTop, false); boolean stackFromRight = a.getBoolean(R.styleable.AbsListView_stackFromBottom, false); setStackFromRight(stackFromRight); boolean scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, true); setScrollingCacheEnabled(scrollingCacheEnabled); boolean useTextFilter = a.getBoolean(R.styleable.AbsListView_textFilterEnabled, false); setTextFilterEnabled(useTextFilter); int transcriptMode = a.getInt(R.styleable.AbsListView_transcriptMode, TRANSCRIPT_MODE_DISABLED); setTranscriptMode(transcriptMode); int color = a.getColor(R.styleable.AbsListView_cacheColorHint, 0); setCacheColorHint(color); boolean smoothScrollbar = a.getBoolean(R.styleable.AbsListView_smoothScrollbar, true); setSmoothScrollbarEnabled(smoothScrollbar); setChoiceMode(a.getInt(R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE)); a.recycle(); }
From source file:com.appunite.list.AbsListView.java
public AbsListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initAbsListView();/*from www.j a v a2s. c om*/ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AbsListView, defStyle, 0); Drawable d = a.getDrawable(R.styleable.AbsListView_listSelector); if (d != null) { setSelector(d); } mDrawSelectorOnTop = a.getBoolean(R.styleable.AbsListView_drawSelectorOnTop, false); boolean stackFromBottom = a.getBoolean(R.styleable.AbsListView_stackFromBottom, false); setStackFromBottom(stackFromBottom); boolean scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, true); setScrollingCacheEnabled(scrollingCacheEnabled); boolean useTextFilter = a.getBoolean(R.styleable.AbsListView_textFilterEnabled, false); setTextFilterEnabled(useTextFilter); int transcriptMode = a.getInt(R.styleable.AbsListView_transcriptMode, TRANSCRIPT_MODE_DISABLED); setTranscriptMode(transcriptMode); int color = a.getColor(R.styleable.AbsListView_cacheColorHint, 0); setCacheColorHint(color); boolean enableFastScroll = a.getBoolean(R.styleable.AbsListView_fastScrollEnabled, false); setFastScrollEnabled(enableFastScroll); boolean smoothScrollbar = a.getBoolean(R.styleable.AbsListView_smoothScrollbar, true); setSmoothScrollbarEnabled(smoothScrollbar); setChoiceMode(a.getInt(R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE)); setFastScrollAlwaysVisible(a.getBoolean(R.styleable.AbsListView_fastScrollAlwaysVisible, false)); a.recycle(); }