本文整理了Java中android.widget.TextView.addOnAttachStateChangeListener()
方法的一些代码示例,展示了TextView.addOnAttachStateChangeListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.addOnAttachStateChangeListener()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:addOnAttachStateChangeListener
暂无
代码示例来源:origin: the-pig-of-jungle/smart-show
btn.addOnAttachStateChangeListener(new ConfirmDelayCallback() {
@ColorInt
private int mConfirmBtnSrcColor = btn.getCurrentTextColor();
代码示例来源:origin: the-pig-of-jungle/SmartShow
btn.addOnAttachStateChangeListener(new ConfirmDelayCallback() {
@ColorInt
private int mConfirmBtnSrcColor = btn.getCurrentTextColor();
代码示例来源:origin: kubode/Wiggle
public ItemView(Context context, int position) {
super(context);
setMinimumHeight((int) (getResources().getDisplayMetrics().density * 80));
inflate(context, R.layout.item, this);
TextView frames = (TextView) findViewById(R.id.frames);
frames.setText("Delay(frames): " + position);
frames.addOnAttachStateChangeListener(new WiggleHelper(WiggleHelper.DelayType.FRAMES, position));
TextView millis = (TextView) findViewById(R.id.millis);
int delayMs = position * 40;
millis.setText("Delay(ms): " + delayMs);
millis.addOnAttachStateChangeListener(new WiggleHelper(WiggleHelper.DelayType.MILLISECONDS, delayMs));
}
}
代码示例来源:origin: noties/Markwon
static void schedule(@NonNull final TextView textView) {
final List<AsyncDrawable> list = extract(textView);
if (list.size() > 0) {
if (textView.getTag(R.id.markwon_drawables_scheduler) == null) {
final View.OnAttachStateChangeListener listener = new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
}
@Override
public void onViewDetachedFromWindow(View v) {
unschedule(textView);
v.removeOnAttachStateChangeListener(this);
v.setTag(R.id.markwon_drawables_scheduler, null);
}
};
textView.addOnAttachStateChangeListener(listener);
textView.setTag(R.id.markwon_drawables_scheduler, listener);
}
for (AsyncDrawable drawable : list) {
drawable.setCallback2(new DrawableCallbackImpl(textView, drawable.getBounds()));
}
}
}
代码示例来源:origin: noties/Markwon
static void schedule(@NonNull final TextView view) {
final Object[] spans = extract(view);
if (spans != null
&& spans.length > 0) {
if (view.getTag(R.id.markwon_tables_scheduler) == null) {
final View.OnAttachStateChangeListener listener = new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
}
@Override
public void onViewDetachedFromWindow(View v) {
unschedule(view);
view.removeOnAttachStateChangeListener(this);
view.setTag(R.id.markwon_tables_scheduler, null);
}
};
view.addOnAttachStateChangeListener(listener);
view.setTag(R.id.markwon_tables_scheduler, listener);
}
final TableRowSpan.Invalidator invalidator = new TableRowSpan.Invalidator() {
@Override
public void invalidate() {
view.setText(view.getText());
}
};
for (Object span : spans) {
((TableRowSpan) span).invalidator(invalidator);
}
}
}
代码示例来源:origin: the-pig-of-jungle/SmartShow
@Override
protected void initBody(Dialog dialog, FrameLayout bodyViewWrapper) {
super.initBody(dialog, bodyViewWrapper);
TextView messageView = bodyViewWrapper.findViewById(R.id.smart_show_dialog_message_view);
messageView.setText(mMessage);
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) messageView.getLayoutParams();
lp.topMargin = Utils.isEmpty(mTitle) ? Utils.dpToPx(7) : 0;
messageView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
TextView msgView = (TextView) v;
if (msgView.getLineCount() > 1) {
msgView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
} else {
msgView.setGravity(Gravity.CENTER);
}
}
@Override
public void onViewDetachedFromWindow(View v) {
}
});
if (mMessageColor != 0) {
messageView.setTextColor(mMessageColor);
}
if (mMessageTextSizeSp > 0) {
messageView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mMessageTextSizeSp);
}
messageView.getPaint().setFakeBoldText(mMessageBold);
}
代码示例来源:origin: the-pig-of-jungle/smart-show
@Override
protected void initBody(Dialog dialog, FrameLayout bodyViewWrapper) {
super.initBody(dialog, bodyViewWrapper);
TextView messageView = bodyViewWrapper.findViewById(R.id.smart_show_dialog_message_view);
messageView.setText(mMessage);
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) messageView.getLayoutParams();
lp.topMargin = Utils.isEmpty(mTitle) ? Utils.dpToPx(7) : 0;
messageView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
TextView msgView = (TextView) v;
if (msgView.getLineCount() > 1) {
msgView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
} else {
msgView.setGravity(Gravity.CENTER);
}
}
@Override
public void onViewDetachedFromWindow(View v) {
}
});
if (mMessageColor != 0) {
messageView.setTextColor(mMessageColor);
}
if (mMessageTextSizeSp > 0) {
messageView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mMessageTextSizeSp);
}
messageView.getPaint().setFakeBoldText(mMessageBold);
}
代码示例来源:origin: gdpancheng/LoonAndroid3
@Init
public void init() {
TinyBus bus = TinyBus.from(Ioc.getIoc().getApplication());
if (!bus.hasRegistered(TimeModule.this)) {
TinyBus.from(Ioc.getIoc().getApplication()).register(TimeModule.this);
}
tv_time.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {
@Override
public void onViewDetachedFromWindow(View arg0) {
TinyBus bus = TinyBus.from(Ioc.getIoc().getApplication());
if (bus.hasRegistered(TimeModule.this)) {
TinyBus.from(Ioc.getIoc().getApplication()).unregister(TimeModule.this);
}
}
@Override
public void onViewAttachedToWindow(View arg0) {
TinyBus bus = TinyBus.from(Ioc.getIoc().getApplication());
if (!bus.hasRegistered(TimeModule.this)) {
TinyBus.from(Ioc.getIoc().getApplication()).register(TimeModule.this);
}
}
});
}
内容来源于网络,如有侵权,请联系作者删除!