suku suku - 1 year ago 70
Android Question

How to find the layout type of a view?

I want to avoid

on doing
. Is there a way by which I can get the layout type i.e Relative, Linear or Frame?
Then I would like to use a switch case on the result and then do

Answer Source

You can use instanceof operator.

if(view instanceof RelativeLayout) {
    // do something
} else if(view instanceof LinearLayout) {
    // do something
} else if(view instanceof FrameLayout) {
    // do something
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download