本文整理汇总了Java中android.widget.TextView.getCompoundPaddingLeft方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.getCompoundPaddingLeft方法的具体用法?Java TextView.getCompoundPaddingLeft怎么用?Java TextView.getCompoundPaddingLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.getCompoundPaddingLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CsDrawableTouchUtils
import android.widget.TextView; //导入方法依赖的package包/类
CsDrawableTouchUtils(MotionEvent event, TextView view, boolean isLayoutRTL){
this.event = event;
this.view = view;
this.isLayoutRTL = isLayoutRTL;
vSpace = view.getHeight() - view.getCompoundPaddingBottom() - view.getCompoundPaddingTop();
hSpace = view.getWidth() - view.getCompoundPaddingRight() - view.getCompoundPaddingLeft();
//if the drawable is extremely large (pushing the edges of the drawable itself
//or of the other drawables out of the current view bounds, will not be possible
//to calculate the correct touch position
if (hSpace < 0 || vSpace < 0){
throw new IllegalArgumentException("The size of one of your drawable is exceeding the" +
" calculated width or height of the view. In this case you should provide" +
"a smaller drawable or provide a smaller dimension in XML or with the builder");
}
scrollX = view.getScrollX();
scrollY = view.getScrollY();
}
示例2: SuggestionStripLayoutHelper
import android.widget.TextView; //导入方法依赖的package包/类
public SuggestionStripLayoutHelper(final Context context, final AttributeSet attrs,
final int defStyle, final ArrayList<TextView> wordViews,
final ArrayList<View> dividerViews, final ArrayList<TextView> debugInfoViews) {
mWordViews = wordViews;
mDividerViews = dividerViews;
mDebugInfoViews = debugInfoViews;
final TextView wordView = wordViews.get(0);
final View dividerView = dividerViews.get(0);
mPadding = wordView.getCompoundPaddingLeft() + wordView.getCompoundPaddingRight();
dividerView.measure(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mDividerWidth = dividerView.getMeasuredWidth();
final Resources res = wordView.getResources();
mSuggestionsStripHeight = res.getDimensionPixelSize(
R.dimen.config_suggestions_strip_height);
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SuggestionStripView, defStyle, R.style.SuggestionStripView);
mSuggestionStripOptions = a.getInt(
R.styleable.SuggestionStripView_suggestionStripOptions, 0);
mAlphaObsoleted = ResourceUtils.getFraction(a,
R.styleable.SuggestionStripView_alphaObsoleted, 1.0f);
mColorValidTypedWord = a.getColor(R.styleable.SuggestionStripView_colorValidTypedWord, 0);
mColorTypedWord = a.getColor(R.styleable.SuggestionStripView_colorTypedWord, 0);
mColorAutoCorrect = a.getColor(R.styleable.SuggestionStripView_colorAutoCorrect, 0);
mColorSuggested = a.getColor(R.styleable.SuggestionStripView_colorSuggested, 0);
mSuggestionsCountInStrip = a.getInt(
R.styleable.SuggestionStripView_suggestionsCountInStrip,
DEFAULT_SUGGESTIONS_COUNT_IN_STRIP);
mCenterSuggestionWeight = ResourceUtils.getFraction(a,
R.styleable.SuggestionStripView_centerSuggestionPercentile,
DEFAULT_CENTER_SUGGESTION_PERCENTILE);
mMaxMoreSuggestionsRow = a.getInt(
R.styleable.SuggestionStripView_maxMoreSuggestionsRow,
DEFAULT_MAX_MORE_SUGGESTIONS_ROW);
mMinMoreSuggestionsWidth = ResourceUtils.getFraction(a,
R.styleable.SuggestionStripView_minMoreSuggestionsWidth, 1.0f);
a.recycle();
mMoreSuggestionsHint = getMoreSuggestionsHint(res,
res.getDimension(R.dimen.config_more_suggestions_hint_text_size),
mColorAutoCorrect);
mCenterPositionInStrip = mSuggestionsCountInStrip / 2;
// Assuming there are at least three suggestions. Also, note that the suggestions are
// laid out according to script direction, so this is left of the center for LTR scripts
// and right of the center for RTL scripts.
mTypedWordPositionWhenAutocorrect = mCenterPositionInStrip - 1;
mMoreSuggestionsBottomGap = res.getDimensionPixelOffset(
R.dimen.config_more_suggestions_bottom_gap);
mMoreSuggestionsRowHeight = res.getDimensionPixelSize(
R.dimen.config_more_suggestions_row_height);
}