本文整理汇总了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);
}