0
저는 Canvas.clipRect() 메서드가 캔버스의 높이를 변경할 수 있다고 생각했지만 사용하지는 않았습니다.안드로이드는 캔버스의 높이를 어떻게 변경합니까?
Log.i(TAG, "getWidth:" + canvas.getWidth()); //getHeight: 914
boolean result = canvas.clipRect(200, 200, 400, 400);
Log.i(TAG, "getHeight:" + canvas.getHeight()); //getHeight: 914
그러나 LinearLayout의 TextView가이를 수행 할 수 있습니다.
<com.example.test.MyLinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical" >
<com.example.test.MyTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test" />
</com.example.testdatepicker.MyLinearLayout>
MyLinearLayout :
protected void dispatchDraw(Canvas canvas) {
Log.i(TAG, "getHeight:" + canvas.getHeight()); //getHeight: 914
super.dispatchDraw(canvas);
}
MyTextView :
protected void draw(Canvas canvas) {
Log.i(TAG, "getHeight:" + canvas.getHeight()); //getHeight: 38
super.draw(canvas);
}
나는 ViewGroup.dispatchDraw() 메소드를 읽은 후 안드로이드 변화를 캔버스의 높이를 수행하는 경우, 내가 찾을 수 없습니다.