I want to implement a TextView, and I override the method "onMearsure()", I just make a simple Layout, activity_main, just a LinearLayout. xml like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> </LinearLayout>
and I put my TextView into this layout by using Java code.like this:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout root = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.activity_main, null);
setContentView(root);
KTextView textView = new KTextView(this, null);
textView.setText("abcd");
root.addView(textView);
}
and now, I made some Log in onMeasure() method, it show the widthMode and heightMode are EXACTLY and AT_MOST. But its parent(LinearLayout)'s width and height both are MATCH_PARENT, so I think width mode and height mode both are AT_MOST.
and I want to know who invoke TextView.onMeasure()? is its parent container?