简体   繁体   中英

Difference between CustomTextView as Parent and Textview as Parent

i created CustomTextview as below

public class CustomTextView extends AppCompatTextView {
        public CustomTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
       // im changing font family here .ttf files
    }
}

.

<com.android.app.CustomTextView
android:id="@+id/view”
/>

what is the difference between

This

CustomTextView textView = findViewbyId(R.id.view);

and this

TextView textView = findViewbyId(R.id.view);

When i put this TextView textView = findViewbyId(R.id.view); IDE runs without throwing error. Why? Thanks!

A real life comparison:

When you learn to drive a manual transmission car, you can drive almost any manual transmission car. Imagine how bad it would be if you had to learn to drive every different model of car you encounter.

Source (+)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM