本文整理匯總了Java中android.text.style.DynamicDrawableSpan.getDrawable方法的典型用法代碼示例。如果您正苦於以下問題:Java DynamicDrawableSpan.getDrawable方法的具體用法?Java DynamicDrawableSpan.getDrawable怎麽用?Java DynamicDrawableSpan.getDrawable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.text.style.DynamicDrawableSpan
的用法示例。
在下文中一共展示了DynamicDrawableSpan.getDrawable方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: release
import android.text.style.DynamicDrawableSpan; //導入方法依賴的package包/類
public void release() {
mText = null;
mReleased = true;
if (lines != null)
lines.clear();
lineSpan = null;
chars = null;
for (int i = 0; i < mDynamicDrawableSpanSparseArray.size(); i++) {
int key = mDynamicDrawableSpanSparseArray.keyAt(i);
DynamicDrawableSpan span = mDynamicDrawableSpanSparseArray.get(key);
Drawable dr = span.getDrawable();
if (dr != null && dr instanceof LazyDrawable) {
((LazyDrawable) dr).Unload();
}
}
mDynamicDrawableSpanSparseArray.clear();
}
示例2: writeImageSpanData
import android.text.style.DynamicDrawableSpan; //導入方法依賴的package包/類
/**
*
* @param span
* @param dos
*/
private void writeImageSpanData(DynamicDrawableSpan span, DataOutputStream dos) {
Drawable d = span.getDrawable();
Bitmap bitmap;
if (d instanceof BitmapDrawable) {
bitmap = ((BitmapDrawable)d).getBitmap();
} else {
bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
d.draw(canvas);
}
bitmap.compress(Bitmap.CompressFormat.JPEG, 90,dos);
bitmap.recycle();
}
示例3: getDynamicDrawablePosition
import android.text.style.DynamicDrawableSpan; //導入方法依賴的package包/類
public int getDynamicDrawablePosition(DynamicDrawableSpan span) {
Drawable dr = span.getDrawable();
if (dr!=null) {
DrawableInfo di = mDrawableInfos.get(dr);
if (di!=null) {
return di.position;
}
}
return -1;
}
示例4: getDynamicDrawableSpanRect
import android.text.style.DynamicDrawableSpan; //導入方法依賴的package包/類
/**
* @param dds - DynamicDrawableSpan
* @param out - Rect instance
* @return true, if dds are visible on layout
*/
public boolean getDynamicDrawableSpanRect(DynamicDrawableSpan dds, Rect out) {
Drawable dr = dds.getDrawable();
if (dr != null && visibleDrawables.contains(dr)) {
Point offset = visibleDrawableOffsets.get(dr);
Rect bounds = visibleDrawableBounds.get(dr);
if (out != null)
out.set(offset.x, offset.y, offset.x + bounds.width(), offset.y + bounds.height());
return true;
}
return false;
}
示例5: registerDrawable
import android.text.style.DynamicDrawableSpan; //導入方法依賴的package包/類
@Override
public void registerDrawable(DynamicDrawableSpan dds, int placement, int position) {
Drawable dr = dds.getDrawable();
DrawableInfo di = new DrawableInfo();
di.span = dds;
di.width = dr.getIntrinsicWidth();
di.height = dr.getIntrinsicHeight();
di.placement = placement;
di.position = position;
mDrawableInfos.put(dr, di);
}