问题描述
简介: 我创建了一个customView,并在初始化时将Glide库用于ImageView。 显然,当我在设备上运行时,一切正常,但是我的customView不在AndroidStudio的预览布局中呈现。
问题: 有没有解决方法,以便可以在AndroidStudio上查看此customView的预览。
代码:
<declare-styleable name="AdView">
<attr name="business_logo_url" format="string"/>
</declare-styleable>
public class AdView extends FrameLayout {
public AdView(@NonNull Context context,@Nullable AttributeSet attrs) {
super(context,attrs);
initView(attrs);
}
public void initView(AttributeSet attrs){
View view = inflate(getContext(),R.layout.layout_ad,this);
TypedArray ta = getContext().obtainStyledAttributes(attrs,R.styleable.AdView);
mBusinesslogoImageView = view.findViewById(R.id.img_logo);
try {
mUrllogo = ta.getString(R.styleable.AdView_business_logo_url);
Glide.with(this).load(mUrllogo).into(mBusinesslogoImageView);
} finally {
ta.recycle();
}
.
.
.
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)