Java 以编程方式添加ShaderImageView
我想让你运行这行代码Java 以编程方式添加ShaderImageView,java,android,imageview,Java,Android,Imageview,我想让你运行这行代码 ShaderImageView imageview = new ShapeImageView(getBaseContext(), null, R.style.hexagonstyle); newphoto.setImageResource(R.drawable.image08); layout.addView(newphoto); 并获取以下错误: Caused by: java.lang.RuntimeException: No resource is defi
ShaderImageView imageview = new ShapeImageView(getBaseContext(), null, R.style.hexagonstyle);
newphoto.setImageResource(R.drawable.image08);
layout.addView(newphoto);
并获取以下错误:
Caused by: java.lang.RuntimeException: No resource is defined as shape
hexagone的定义是
<style name="hexagonstyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="siBorderColor">@color/hexagoninnerborder</item>
<item name="siBorderWidth">1dp</item>
<item name="siShape">@raw/maskcopya</item>
</style>
有关ShapeImageView的更多信息:
如何以编程方式添加ShapeImageView?也许ShapeImageView的参数是错误的
提前谢谢 反过来说:
View view = LayoutInflater.from(this).inflate(R.layout.contactlist, null);
ImageView contactimage = (ImageView) view.findViewById(R.id.contactimage);
我将ShaderImageView放入contactlist.xml并在其中设置样式
已解决:
View view = LayoutInflater.from(this).inflate(R.layout.contactlist, null);
ImageView contactimage = (ImageView) view.findViewById(R.id.contactimage);