下面列出了android.widget.TextView#setTag ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static void unschedule(@NonNull TextView view) {
// @since 4.0.0
if (view.getTag(R.id.markwon_drawables_scheduler_last_text_hashcode) == null) {
return;
}
view.setTag(R.id.markwon_drawables_scheduler_last_text_hashcode, null);
final AsyncDrawableSpan[] spans = extractSpans(view);
if (spans != null
&& spans.length > 0) {
for (AsyncDrawableSpan span : spans) {
span.getDrawable().setCallback2(null);
}
}
}
public HeaderCell(Context context, String textColorKey, int padding, int topMargin, boolean text2) {
super(context);
textView = new TextView(getContext());
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
textView.setMinHeight(AndroidUtilities.dp(height - topMargin));
textView.setTextColor(Theme.getColor(textColorKey));
textView.setTag(textColorKey);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, topMargin, padding, 0));
if (text2) {
textView2 = new SimpleTextView(getContext());
textView2.setTextSize(13);
textView2.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP);
addView(textView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, padding, 21, padding, 0));
}
}
public void initView(Context context) {
setOrientation(LinearLayout.VERTICAL);
View view = View.inflate(context, R.layout.appdetail_item_desc, null);
titleTextView = (TextView) view.findViewById(R.id.detail_desc_title_textview);
contentTextView = (TextView) view.findViewById(R.id.detail_desc_content_textview);
foldImage = (ImageView) view.findViewById(R.id.detail_desc_folding_imageview);
flContent = (FrameLayout) view.findViewById(R.id.fl_content);
flContent.getLayoutParams().height = getTileHeight() + getShortHeight();
contentTextView.setOnClickListener(this);
foldImage.setOnClickListener(this);
contentTextView.setTag(false);
foldImage.setTag(false);
addView(view);
}
public void addTab(String title, OnClickListener onClickListener) {
View view = mInflater.inflate(R.layout.item_tab_text, mLayout, false);
TextView textView = (TextView) view.findViewById(R.id.file_name);
textView.setOnClickListener(onClickListener);
textView.setText(title);
textView.setTag(R.id.tag, mLayout.getChildCount());
if (mLayout.getChildCount() <= 0) {
//第一个就隐藏箭头
view.findViewById(R.id.arrow).setVisibility(View.GONE);
} else {
//设置前一个的字体颜色
TextView lastTitle = (TextView) mLayout.getChildAt(mLayout.getChildCount() - 1).findViewById(R.id.file_name);
lastTitle.setTextColor(0x88ffffff);
}
mLayout.addView(view, mLayout.getChildCount());
//滑到最右边
this.postDelayed(() -> this.smoothScrollBy(1000, 0), 5);
}
private void setupSourceView(SlobDescriptor desc, boolean available, View view) {
View sourceRow = view.findViewById(R.id.dictionary_license_row);
ImageView sourceIcon = (ImageView) view.findViewById(R.id.dictionary_source_icon);
sourceIcon.setImageDrawable(IconMaker.text(context, IconMaker.IC_EXTERNAL_LINK));
TextView sourceView = (TextView) view.findViewById(R.id.dictionary_source);
String source = desc.tags.get("source");
CharSequence sourceHtml = Html.fromHtml(String.format(hrefTemplate, source, source));
sourceView.setText(sourceHtml);
sourceView.setTag(source);
int visibility = Util.isBlank(source) ? View.GONE : View.VISIBLE;
//Setting visibility on layout seems to have no effect
//if one of the children is a link
sourceIcon.setVisibility(visibility);
sourceView.setVisibility(visibility);
sourceRow.setVisibility(visibility);
sourceRow.setEnabled(available);
}
public HeaderCell(Context context, String textColorKey, int padding, int topMargin, boolean text2) {
super(context);
textView = new TextView(getContext());
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
textView.setMinHeight(AndroidUtilities.dp(height - topMargin));
textView.setTextColor(Theme.getColor(textColorKey));
textView.setTag(textColorKey);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, topMargin, padding, 0));
if (text2) {
textView2 = new SimpleTextView(getContext());
textView2.setTextSize(13);
textView2.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP);
addView(textView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, padding, 21, padding, 0));
}
}
private <T> void addLabel(T data, int position, LabelTextProvider<T> provider) {
TextView label = new TextView(this.mContext);
label.setPadding(this.mTextPaddingLeft, this.mTextPaddingTop, this.mTextPaddingRight, this.mTextPaddingBottom);
label.setTextSize(0, this.mTextSize);
label.setTextColor(this.mTextColor != null ? this.mTextColor : ColorStateList.valueOf(ViewCompat.MEASURED_STATE_MASK));
label.setBackgroundDrawable(this.mLabelBg.getConstantState().newDrawable());
label.setTag(KEY_DATA, data);
label.setTag(KEY_POSITION, Integer.valueOf(position));
label.setOnClickListener(this);
addView(label);
label.setText(provider.getLabelText(label, position, data));
}
public void addTask(View view)
{
//模拟路径
String path = "/sdcard/imgs/" + (++i) + ".png";
UploadImgService.startUploadImg(this, path);
TextView tv = new TextView(this);
mLyTaskContainer.addView(tv);
tv.setText(path + " is uploading ...");
tv.setTag(path);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_list);
context = AppListActivity.this;
appList = (ListView)findViewById(R.id.appList);
btnMobileApps = (TextView)findViewById(R.id.btnMobileApps);
btnWebApps = (TextView)findViewById(R.id.btnWebApps);
txtError = (TextView)findViewById(R.id.txtError);
txtNoAppsFound = (TextView)findViewById(R.id.txtNoAppsFound);
btnSignOut = (TextView)findViewById(R.id.btnSignOut);
etSearch = (EditText)findViewById(R.id.etSearch);
spinner = (Spinner)findViewById(R.id.spinner);
mobileApps = new ArrayList<>();
webApps = new ArrayList<>();
appList.setVisibility(View.GONE);
txtError.setVisibility(View.GONE);
txtNoAppsFound.setVisibility(View.GONE);
mobileAppCategories = new ArrayList<>();
webAppCategories = new ArrayList<>();
mobileAppCategories.add(getResources().getString(R.string.filter_hint));
webAppCategories.add(getResources().getString(R.string.filter_hint));
btnMobileApps.setVisibility(View.GONE);
btnMobileApps.setTag(TAG_BTN_MOBILE_APPS);
btnMobileApps.setOnClickListener(onClickListener);
btnWebApps.setVisibility(View.GONE);
btnWebApps.setTag(TAG_BTN_WEB_APPS);
btnWebApps.setOnClickListener(onClickListener);
if (CommonUtils.isNetworkAvailable(context)) {
getAppList();
} else {
CommonDialogUtils.showNetworkUnavailableMessage(AppListActivity.this);
}
}
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
mBusy = false;
int first = view.getFirstVisiblePosition();
int count = view.getChildCount();
for (int i=0; i<count; i++) {
TextView t = (TextView)view.getChildAt(i);
if (t.getTag() != null) {
t.setText(mStrings[first + i]);
t.setTag(null);
}
}
mStatus.setText("Idle");
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
mBusy = true;
mStatus.setText("Touch scroll");
break;
case OnScrollListener.SCROLL_STATE_FLING:
mBusy = true;
mStatus.setText("Fling");
break;
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final Drawable drawable = getResources().getDrawable(R.mipmap.ic_launcher);
drawable.setBounds(0, 0,drawable.getMinimumHeight() , drawable.getMinimumHeight());
TextView textview = new TextView(MainActivity.this);
textview.setTextColor(getResources().getColor(android.R.color.white));
textview.setText(R.string.text);
textview.setCompoundDrawables(null, drawable, null, null);
textview.setTag(tag++ +"");
return textview;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
Log.i(TAG, "instantiateItem>>>" + position);
View child = chilren.get(position);
if (child == null) {
child = inflater.inflate(R.layout.target_poi_item_detail, null);
chilren.put(position, child);
}
child.findViewById(R.id.tpid_target_confirm_bt).setOnClickListener(clickListener);
child.findViewById(R.id.tpid_target_confirm_bt).setTag(position);
((TextView) child.findViewById(R.id.tpid_name_text)).setText((position + 1) + "." + aList.get(position).getName());
((TextView) child.findViewById(R.id.tpid_address_text)).setText(aList.get(position).getAddress());
Double distance = DistanceUtil.getDistance(new LatLng(address.getLatitude(), address.getLongitude()),
poiInfoList.get(position).location) / 1000;
((TextView) child.findViewById(R.id.tpid_distance_text)).setText(String.format("%.1f", distance) + "km");
child.findViewById(R.id.tpid_set_target_bt).setOnClickListener(clickListener);
child.findViewById(R.id.tpid_set_target_bt).setTag(position);
TextView ft = (TextView) child.findViewById(R.id.tpid_favorite_bt);
ft.setOnClickListener(clickListener);
ft.setTag(position);
if (aList.get(position).getFavoritedTime() != null) {
ft.setText("已收藏");
((LevelListDrawable) ft.getBackground()).setLevel(1);
}
container.addView(child, 0);
return chilren.get(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
IconContextMenuItem item = (IconContextMenuItem) getItem(position);
Resources res = parentActivity.getResources();
if (convertView == null) {
TextView temp = new TextView(context);
AbsListView.LayoutParams param = new AbsListView.LayoutParams(AbsListView.LayoutParams.FILL_PARENT,
AbsListView.LayoutParams.WRAP_CONTENT);
temp.setLayoutParams(param);
temp.setPadding((int)toPixel(res, 20), 2, (int)toPixel(res, 20), 2);
temp.setGravity(android.view.Gravity.CENTER_VERTICAL);
Theme th = context.getTheme();
TypedValue tv = new TypedValue();
if (th.resolveAttribute(android.R.attr.textAppearanceLargeInverse, tv, true)) {
temp.setTextAppearance(context, tv.resourceId);
}
temp.setMinHeight(LIST_PREFERED_HEIGHT);
temp.setCompoundDrawablePadding((int)toPixel(res, 14));
convertView = temp;
}
TextView textView = (TextView) convertView;
textView.setTag(item);
textView.setText(item.text);
textView.setTextColor(Color.WHITE);
textView.setTypeface(typeface);
Bitmap bitmap = ((BitmapDrawable) item.image).getBitmap();
Drawable d = new BitmapDrawable(parent.getResources(), Bitmap.createScaledBitmap(bitmap, LIST_PREFERED_HEIGHT, LIST_PREFERED_HEIGHT, true));
textView.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
return textView;
}
private void sove() {
GradientDrawable dd = new GradientDrawable();
dd.setCornerRadii(new float[]{(float) this.radius, (float) this.radius, (float) this.radius, (float) this.radius, (float) this.radius, (float) this.radius, (float) this.radius, (float) this.radius});
dd.setStroke(this.lineStroke, this.lineColor);
if (VERSION.SDK_INT >= 16) {
setBackground(dd);
} else {
setBackgroundDrawable(dd);
}
removeAllViews();
if (this.curIndex >= this.textArr.length || this.curIndex < 0) {
this.curIndex = 0;
}
for (int i = 0; i < this.textArr.length; i++) {
TextView tv = new TextView(getContext());
LayoutParams params = new LayoutParams(0, -1);
if (i > 0) {
params.leftMargin = this.space;
}
GradientDrawable d = getFitGradientDrawable(i);
if (this.curIndex == i) {
tv.setTextColor(this.selectTextColor);
d.setColor(this.selectTabBg);
} else {
tv.setTextColor(this.unSelectTextColor);
d.setColor(this.unSelectTabBg);
}
tv.setText(this.textArr[i]);
tv.setGravity(17);
tv.setTextSize(0, this.textSize);
if (VERSION.SDK_INT >= 16) {
tv.setBackground(d);
} else {
tv.setBackgroundDrawable(d);
}
params.weight = 1.0f;
tv.setLayoutParams(params);
tv.setTag(Integer.valueOf(i));
tv.setOnClickListener(this);
addView(tv);
}
}
void updateCrumbs() {
FragmentManager fm = mActivity.getFragmentManager();
int numEntries = fm.getBackStackEntryCount();
int numPreEntries = getPreEntryCount();
int numViews = mContainer.getChildCount();
for (int i = 0; i < numEntries + numPreEntries; i++) {
BackStackEntry bse = i < numPreEntries
? getPreEntry(i)
: fm.getBackStackEntryAt(i - numPreEntries);
if (i < numViews) {
View v = mContainer.getChildAt(i);
Object tag = v.getTag();
if (tag != bse) {
for (int j = i; j < numViews; j++) {
mContainer.removeViewAt(i);
}
numViews = i;
}
}
if (i >= numViews) {
final View item = mInflater.inflate(mLayoutResId, this, false);
final TextView text = (TextView) item.findViewById(com.android.internal.R.id.title);
text.setText(bse.getBreadCrumbTitle());
text.setTag(bse);
text.setTextColor(mTextColor);
if (i == 0) {
item.findViewById(com.android.internal.R.id.left_icon).setVisibility(View.GONE);
}
mContainer.addView(item);
text.setOnClickListener(mOnClickListener);
}
}
int viewI = numEntries + numPreEntries;
numViews = mContainer.getChildCount();
while (numViews > viewI) {
mContainer.removeViewAt(numViews - 1);
numViews--;
}
// Adjust the visibility and availability of the bread crumbs and divider
for (int i = 0; i < numViews; i++) {
final View child = mContainer.getChildAt(i);
// Disable the last one
child.findViewById(com.android.internal.R.id.title).setEnabled(i < numViews - 1);
if (mMaxVisible > 0) {
// Make only the last mMaxVisible crumbs visible
child.setVisibility(i < numViews - mMaxVisible ? View.GONE : View.VISIBLE);
final View leftIcon = child.findViewById(com.android.internal.R.id.left_icon);
// Remove the divider for all but the last mMaxVisible - 1
leftIcon.setVisibility(i > numViews - mMaxVisible && i != 0 ? View.VISIBLE
: View.GONE);
}
}
}
private View create(RxPopupView rxPopupView) {
if (rxPopupView.getAnchorView() == null) {
Log.e(TAG, "Unable to create a tip, anchor view is null");
return null;
}
if (rxPopupView.getRootView() == null) {
Log.e(TAG, "Unable to create a tip, root layout is null");
return null;
}
// only one tip is allowed near an anchor view at the same time, thus
// reuse tip if already exist
if (mTipsMap.containsKey(rxPopupView.getAnchorView().getId())) {
return mTipsMap.get(rxPopupView.getAnchorView().getId());
}
// init tip view parameters
TextView tipView = createTipView(rxPopupView);
// on RTL languages replace sides
if (RxPopupViewTool.isRtl()) {
switchToolTipSidePosition(rxPopupView);
}
// set tool tip background / shape
RxPopupViewBackgroundConstructor.setBackground(tipView, rxPopupView);
// add tip to root layout
rxPopupView.getRootView().addView(tipView);
// find where to position the tool tip
Point p = RxPopupViewCoordinatesFinder.getCoordinates(tipView, rxPopupView);
// move tip view to correct position
moveTipToCorrectPosition(tipView, p);
// set dismiss on click
tipView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss(view, true);
}
});
// bind tipView with anchorView id
int anchorViewId = rxPopupView.getAnchorView().getId();
tipView.setTag(anchorViewId);
// enter tip to map by 'anchorView' id
mTipsMap.put(anchorViewId, tipView);
return tipView;
}
@Override
public void onFileDownloadStatusDownloading(DownloadFileInfo downloadFileInfo, float downloadSpeed, long
remainingTime) {
if (downloadFileInfo == null) {
return;
}
String url = downloadFileInfo.getUrl();
View cacheConvertView = mConvertViews.get(url);
if (cacheConvertView != null) {
LinearLayout lnlyDownloadItem = (LinearLayout) cacheConvertView.findViewById(R.id.lnlyDownloadItem);
ProgressBar pbProgress = (ProgressBar) cacheConvertView.findViewById(R.id.pbProgress);
TextView tvDownloadSize = (TextView) cacheConvertView.findViewById(R.id.tvDownloadSize);
TextView tvTotalSize = (TextView) cacheConvertView.findViewById(R.id.tvTotalSize);
TextView tvPercent = (TextView) cacheConvertView.findViewById(R.id.tvPercent);
TextView tvText = (TextView) cacheConvertView.findViewById(R.id.tvText);
// download progress
int totalSize = (int) downloadFileInfo.getFileSizeLong();
int downloaded = (int) downloadFileInfo.getDownloadedSizeLong();
double rate = (double) totalSize / Integer.MAX_VALUE;
if (rate > 1.0) {
totalSize = Integer.MAX_VALUE;
downloaded = (int) (downloaded / rate);
}
// pbProgress.setMax(totalSize);
pbProgress.setProgress(downloaded);
// download size
double downloadSize = downloadFileInfo.getDownloadedSizeLong() / 1024f / 1024f;
double fileSize = downloadFileInfo.getFileSizeLong() / 1024f / 1024f;
tvDownloadSize.setText(((float) (Math.round(downloadSize * 100)) / 100) + "M/");
tvTotalSize.setText(((float) (Math.round(fileSize * 100)) / 100) + "M");
// download percent
double percent = downloadSize / fileSize * 100;
tvPercent.setText(((float) (Math.round(percent * 100)) / 100) + "%");
// download speed and remain times
String speed = ((float) (Math.round(downloadSpeed * 100)) / 100) + "KB/s" + " " + TimeUtil
.seconds2HH_mm_ss(remainingTime);
tvText.setText(speed);
tvText.setTag(speed);
setBackgroundOnClickListener(lnlyDownloadItem, downloadFileInfo);
} else {
updateShow();
}
Log.d(TAG, "onFileDownloadStatusDownloading url:" + url + ",status(正常应该是" + Status
.DOWNLOAD_STATUS_DOWNLOADING + "):" + downloadFileInfo.getStatus());
}
@Override
protected void onFinishInflate() {
mTabHost = (TabHost)findViewById(R.id.emoji_category_tabhost);
mTabHost.setup();
for (final EmojiCategory.CategoryProperties properties
: mEmojiCategory.getShownCategories()) {
addTab(mTabHost, properties.mCategoryId);
}
mTabHost.setOnTabChangedListener(this);
final TabWidget tabWidget = mTabHost.getTabWidget();
tabWidget.setStripEnabled(mCategoryIndicatorEnabled);
if (mCategoryIndicatorEnabled) {
// On TabWidget's strip, what looks like an indicator is actually a background.
// And what looks like a background are actually left and right drawables.
tabWidget.setBackgroundResource(mCategoryIndicatorDrawableResId);
tabWidget.setLeftStripDrawable(mCategoryIndicatorBackgroundResId);
tabWidget.setRightStripDrawable(mCategoryIndicatorBackgroundResId);
}
mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this);
mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager);
mEmojiPager.setAdapter(mEmojiPalettesAdapter);
mEmojiPager.setOnPageChangeListener(this);
mEmojiPager.setOffscreenPageLimit(0);
mEmojiPager.setPersistentDrawingCache(PERSISTENT_NO_CACHE);
mEmojiLayoutParams.setPagerProperties(mEmojiPager);
mEmojiCategoryPageIndicatorView =
(EmojiCategoryPageIndicatorView)findViewById(R.id.emoji_category_page_id_view);
mEmojiCategoryPageIndicatorView.setColors(
mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground);
mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView);
setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */);
final LinearLayout actionBar = (LinearLayout)findViewById(R.id.emoji_action_bar);
mEmojiLayoutParams.setActionBarProperties(actionBar);
// deleteKey depends only on OnTouchListener.
mDeleteKey = (ImageButton)findViewById(R.id.emoji_keyboard_delete);
mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
mDeleteKey.setTag(Constants.CODE_DELETE);
mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
// {@link #mAlphabetKeyLeft}, {@link #mAlphabetKeyRight, and spaceKey depend on
// {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
// {@link View.OnTouchListener} is used as the trigger of key-press, while
// {@link View.OnClickListener} is used as the trigger of key-release which does not occur
// if the event is canceled by moving off the finger from the view.
// The text on alphabet keys are set at
// {@link #startEmojiPalettes(String,int,float,Typeface)}.
mAlphabetKeyLeft = (TextView)findViewById(R.id.emoji_keyboard_alphabet_left);
mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
mAlphabetKeyLeft.setOnTouchListener(this);
mAlphabetKeyLeft.setOnClickListener(this);
mAlphabetKeyRight = (TextView)findViewById(R.id.emoji_keyboard_alphabet_right);
mAlphabetKeyRight.setBackgroundResource(mFunctionalKeyBackgroundId);
mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
mAlphabetKeyRight.setOnTouchListener(this);
mAlphabetKeyRight.setOnClickListener(this);
mSpacebar = findViewById(R.id.emoji_keyboard_space);
mSpacebar.setBackgroundResource(mSpacebarBackgroundId);
mSpacebar.setTag(Constants.CODE_SPACE);
mSpacebar.setOnTouchListener(this);
mSpacebar.setOnClickListener(this);
mEmojiLayoutParams.setKeyProperties(mSpacebar);
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
}
public DrawableGetter(TextView tv, int width) {
tv.setTag(R.id.drawable_callback, this);
this.container = new WeakReference<>(tv);
this.cachedTargets = new HashSet<>();
this.width = width;
}
private void resetTextArea(TextView textArea, SPEC.PAGE type, int gravity) {
((View) textArea.getParent()).scrollTo(0, 0);
textArea.setTag(type);
textArea.setGravity(gravity);
}