我搞砸了一些东西,最后一无所获。谁能告诉我一个非常基本的例子,如何使用路径显示带有边框轮廓的弹出窗口。请不要张贴XML形状。我需要使用路径,因为轮廓不是矩形的。
我有一些poc工作,但后来我完全搞砸了,现在什么都没有了。
我所拥有的基本情况是(不是完整的代码):
public myPop extends PopupWindow {
public myPop(Conext context) {
super(context);
setFocusable(true);
setWindowLayoutMode(View.MeasureSpec.makeMeasureSpec(300, View.MeasureSpec.AT_MOST), ViewGroup.LayoutParams.WRAP_CONTENT);
LayoutInflater inflater = LayoutInflater.from(context);
layout = inflater.inflate(R.layout.settings2, null);
//setBackgroundDrawable(new ColorDrawable(Color.BLUE));
Path path = new Path();
path.moveTo(0, 0);
path.lineTo(100, 0);
path.lineTo(100, 100);
setBackgroundDrawable(new OutlineDrawable(path);
setContentView(layout);
}
public void show() {
showAtLocation(this.parent, Gravity.NO_GRAVITY, 100, 500);
}
}OutlineDrawable只不过是扩展了Drawable,在draw()中,我使用给定的路径调用drawPath(),并使用笔划样式进行绘制。
发布于 2013-04-15 17:02:33
抱歉的。我找到我的问题了。可绘制油漆的字母0是错误的。我知道这一定是我犯了一些愚蠢的打字错误。啊。
https://stackoverflow.com/questions/16010416
复制相似问题