Android drawable转uri或url,drawable转view

Resources r =mContext.getResources();
Uri uri =  Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
        + r.getResourcePackageName(R.mipmap.jcss_03) + "/"
        + r.getResourceTypeName(R.mipmap.jcss_03) + "/"
        + r.getResourceEntryName(R.mipmap.jcss_03));

 

getGuideView(R.drawable.wsfzf)

 

private View getGuideView(int nDrawableID) {
    ImageView iv = new ImageView(this);
    ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    iv.setLayoutParams(lp);
    iv.setScaleType(ImageView.ScaleType.FIT_XY);
    iv.setImageResource(nDrawableID);
    return iv;
}

 

你可能感兴趣的:(Android开发)