我有一個圖像視圖。我從可繪製的圖像視圖設置了一個圖像。現在我想在該圖像的邊界上畫線。誰能幫助實現這一目標?我審查了使用路徑它可以完成。我想提請行只在動畫的方式,圖像的邊界...在此先感謝..僅在圖像邊框上使用Android繪製線條動畫
我試圖像這樣
Path path = new Path();
Canvas c = new Canvas();
path.addRect(view.getLeft(),view.getTop(),view.getRight(),view.getBottom(),Path.Direction.CW);
Paint p = new Paint();
p.setColor(Color.GREEN);
c.drawPath(path, p);
我嘗試了上面的相同代碼,但沒有出現在我的屏幕中。我只有相同的圖像。 – Balaji
Path path = new Path(); Canvas c = new Canvas(); \t \t Paint mPaint = new Paint(); \t \t //球員是我在這裏的圖像 \t \t path.addRect(player.getLeft(),player.getTop(),player.getRight(),player.getBottom(),Path.Direction.CW); \t \t PathEffect pe = new DashPathEffect(new float [] {10,5,5,5},phase); \t \t mPaint.setPathEffect(pe); \t \t mPaint.setColor(Color.GREEN); \t \t c.drawPath(path,mPaint); – Balaji