android - Hide ImageView on horizontal -
i have imageview in program, limits viewing area.
<imageview android:layout_width="match_parent" android:scaletype="centerinside" app:srccompat="@drawable/log_t" android:id="@+id/imageview4" android:layout_alignparentstart="true" android:layout_marginbottom="10dp" android:layout_height="100dp" />
how make invisible @ screen horizontal orientation , again visible in vertical?
can in 1 xml layout? or must separate layout horizontal view , vertical view?
in container activity can add:
@override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); // checks orientation of screen if (newconfig.orientation == configuration.orientation_landscape) { imageview.setvisibility(view.invisible) (or gone instead of invisible) } else if (newconfig.orientation == configuration.orientation_portrait){ imageview.setvisibility(view.visible) } }
Comments
Post a Comment