2017-02-17 68 views

回答

1

將視圖作爲子視圖添加到另一個視圖中之後。你應該這樣走。

public void someMethod() { 
View parentView; 

View childView = (View)findViewById(R.id.my_view); 
parentView.addView(childView); 

// Now perform your calculations here. which you want to modify for childView. after that just call the invalidate() method to take changes effect. 

parentView.invalidate(); 
} 

希望這會有所幫助。隨意告知答案是否與預期不符。