我需要創建一個自定義視圖,該視圖代表水平RecyclerView,並在其周圍顯示邊框。邊框的左側和右側可以通過RecyclerView項目拖動。這就像用於視頻剪輯的UI。 據我瞭解,我需要創造這樣的:使用水平RecyclerView和自定義邊框(帶移動偵聽器)創建自定義視圖
public class CustomView extends RecyclerView {
....
onDraw(Canvas cancas) {
// And there should be code to draw a borders like:
Paint paint = new Paint();
paint.setColor(Color.RED);
paint.setStrokeWidth(1.5f);
paint.setStyle(Paint.Style.STROKE);
canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
....
}
}
裏面粉紅色的邊框應該是RecyclerView裏面的圖像。這是我想要做的。
answer - https://stackoverflow.com/a/35037187/4647628 – Aks4125