Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

android - Is it possible to place an imageView in a class that extends View?

Is it possible to place an imageView in a class that extends View in android? If possible please give me a sample code. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to create a custom view that contains an ImageView (and presumably some other items), you probably just want to extend a ViewGroup, such as a RelativeLayout rather than directly extending View.

See the "Compound Controls" section of the Custom Components page on the Android Developers' site.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...