My app has three views in portrait mode, a TextSwitcher, a custom view and a custom keyboard.
In the landscape mode I need to remove the TextSwitcher and add a ListView in the right side.
I am new to android , I can define two layouts namely xxx and xxx-land, my problem is how to implement two branch of code, one for controling landscape and one for portrait.
My app has three views in portrait mode, a TextSwitcher, a custom view and
Share
define all Views that appears in both resource file in you code
and in the
onCreate()in theActivityyou can check the orientation to bind the Views to your class object .example.
here we have 2 layout files that contain an ImageView in both files and in the portrait file there is an
TextViewand in the landscape it contain aButtoninstead of theTextViewmy_layout.xml in layout-land
my_layout.xml in layout-port folder
here is the Activity code
ask anything that you don’t understand .