android.widget.TextView.invalidate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(219)

本文整理了Java中android.widget.TextView.invalidate()方法的一些代码示例,展示了TextView.invalidate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.invalidate()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:invalidate

TextView.invalidate介绍

暂无

代码示例

代码示例来源:origin: ankidroid/Anki-Android

@Override
  protected void onPostExecute(String todayStatString) {
    if (todayStatString != null && mIsRunning) {
      mTextView.setText(todayStatString);
      mTextView.setVisibility(View.VISIBLE);
      mTextView.invalidate();
    }
  }
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void invalidate(@NonNull Rect dirty) {
  super.invalidate(dirty);
  invalidateParentIfNeeded();
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void invalidate(int l, int t, int r, int b) {
  super.invalidate(l, t, r, b);
  invalidateParentIfNeeded();
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void invalidate() {
  super.invalidate();
  invalidateParentIfNeeded();
}

代码示例来源:origin: PrivacyApps/html-textview

@Override
protected void onPostExecute(Drawable result) {
  if (result == null) {
    Log.w(HtmlTextView.TAG, "Drawable result is null! (source: " + source + ")");
    return;
  }
  final UrlDrawable urlDrawable = drawableReference.get();
  if (urlDrawable == null) {
    return;
  }
  // set the correct bound according to the result from HTTP call
  urlDrawable.setBounds(0, 0, (int) (result.getIntrinsicWidth() * scale), (int) (result.getIntrinsicHeight() * scale));
  // change the reference of the current drawable to the result from the HTTP call
  urlDrawable.drawable = result;
  final HtmlHttpImageGetter imageGetter = imageGetterReference.get();
  if (imageGetter == null) {
    return;
  }
  // redraw the image by invalidating the container
  imageGetter.container.invalidate();
  // re-set text to fix images overlapping text
  imageGetter.container.setText(imageGetter.container.getText());
}

代码示例来源:origin: stackoverflow.com

private static SpannableStringBuilder addClickablePartTextViewResizable(final Spanned strSpanned, final TextView tv,
                                     final int maxLine, final String spanableText, final boolean viewMore) {
   String str = strSpanned.toString();
   SpannableStringBuilder ssb = new SpannableStringBuilder(strSpanned);
   if (str.contains(spanableText)) {
     ssb.setSpan(new MySpannable(false){
       @Override
       public void onClick(View widget) {
         if (viewMore) {
           tv.setLayoutParams(tv.getLayoutParams());
           tv.setText(tv.getTag().toString(), BufferType.SPANNABLE);
           tv.invalidate();
           makeTextViewResizable(tv, -1, "View Less", false);
         } else {
           tv.setLayoutParams(tv.getLayoutParams());
           tv.setText(tv.getTag().toString(), BufferType.SPANNABLE);
           tv.invalidate();
           makeTextViewResizable(tv, 3, "View More", true);
         }
       }
     }, str.indexOf(spanableText), str.indexOf(spanableText) + spanableText.length(), 0);
   }
   return ssb;
 }

代码示例来源:origin: iSoron/uhabits

mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
  tryStartingKbMode(-1);
  mHourView.invalidate();
} else if (mTypedTimes == null) {
  mTypedTimes = new ArrayList<Integer>();

代码示例来源:origin: wangdan/AisenWeiBo

mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
  tryStartingKbMode(-1);
  mHourView.invalidate();
} else if (mTypedTimes == null) {
  mTypedTimes = new ArrayList<Integer>();

代码示例来源:origin: wdullaer/MaterialDateTimePicker

mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
  tryStartingKbMode(-1);
  mHourView.invalidate();
} else if (mTypedTimes == null) {
  mTypedTimes = new ArrayList<>();

代码示例来源:origin: GcsSloop/diycode

@Override
public void invalidateDrawable(Drawable who) {
  mTextView.invalidate();
}

代码示例来源:origin: GeekGhost/Ghost

@Override
public void handleMessage(Message msg) {
  if (WHAT == msg.what) {
    textView.setMaxLines(msg.arg1);
    textView.invalidate();
  } else if (WHAT_ANIMATION_END == msg.what) {
    setExpandState(msg.arg1);
  } else if (WHAT_EXPAND_ONLY == msg.what) {
    changeExpandState(msg.arg1);
  }
  super.handleMessage(msg);
}

代码示例来源:origin: retomeier/Wrox-ProfessionalAndroid-4E

public void run() {
  String currentG = mCurrentAcceleration /
            SensorManager.STANDARD_GRAVITY
            + "Gs";
  mAccelerationTextView.setText(currentG);
  mAccelerationTextView.invalidate();
  String maxG = mMaxAcceleration/SensorManager.STANDARD_GRAVITY
          + "Gs";
  mMaxAccelerationTextView.setText(maxG);
  mMaxAccelerationTextView.invalidate();
 }
});

代码示例来源:origin: GcsSloop/diycode

getView().invalidate();

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
public void invalidateDrawable(@NonNull Drawable who) {
  Log.d("drawable2", "invalidateDrawable");
  textView.invalidate();
}

代码示例来源:origin: TMLAndroid/FillBlankDemo

public void setData(String str, Object o, int i){
  if (mTv == null || mSpans == null ||mSpans.size() == 0 || i < 0 ||i > mSpans.size() - 1)return;
  ReplaceSpan span = mSpans.get(i);
  span.mText = str;
  span.mObject = o;
  mTv.invalidate();
}

代码示例来源:origin: lessthanoptimal/BoofAndroidDemo

public void onItemClick(AdapterView<?> parent, View v,
              int position, long id) {
    v.setSelected(true);
    FiducialManager.Info info = list.get(position);
    textName.setText(info.name);
    textSize.setText(info.sideLength+" "+info.units.getSmall());
    textName.invalidate();
    textSize.invalidate();
  }
});

代码示例来源:origin: googlesamples/android-unsplash

@Override
public void invalidateSelf() {
  super.invalidateSelf();
  view.invalidate();
}

代码示例来源:origin: DroidsOnRoids/Workcation

@Override
public void invalidateSelf() {
  super.invalidateSelf();
  view.invalidate();
}

代码示例来源:origin: zhao-mingjian/qvod

@Override
public void handleMessage(Message msg) {
  if (WHAT == msg.what) {
    textView.setMaxLines(msg.arg1);
    textView.invalidate();
  } else if (WHAT_ANIMATION_END == msg.what) {
    setExpandState(msg.arg1);
  } else if (WHAT_EXPAND_ONLY == msg.what) {
    changeExpandState(msg.arg1);
  }
  super.handleMessage(msg);
}

代码示例来源:origin: babylikebird/htmlImage

@Override
  public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    super.onLoadingComplete(imageUri, view, loadedImage);
    urlDrawable.bitmap = loadedImage;
    urlDrawable.setBounds(0, 0, loadedImage.getWidth(), loadedImage.getHeight());
    textView.invalidate();
    textView.setText(textView.getText()); // 解决图文重叠
  }
});

相关文章

TextView类方法