Data Binding for alternative layouts


I have faced with an issue with data binding for different layouts.
I have layout file for different orientation.
For portrait mode:



<layout
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>
</layout>


and for landspace mode:



<layout
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent" />

<FrameLayout
android:id="@+id/extra_container"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent" />

</LinearLayout>
</layout>


And when I use it for binding via



ViewBinding binding = DataBindingUtil.setContentView(this,
R.layout.view);


I have no access for extraContainer from current
binding.



Possible solution to add the view with same id and check the view
class in runtime. Any other solutions ?


- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow