I'm trying to show two charts in my activity. One LineChart and one ScatterChart. If the smartphone / tablet is in portrait, the charts shall be among each other. If the device is in landscape, the shall be side-by-side, each with 50 % of space.
I'm stucked here. Should I use a LinearLayout for each chart or one for both? How can I align them the right way?
Thanks for your help!
put both your linear layouts inside a LinearLayout
, with both of them having width="0dp"
, and weight="1"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/chart1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/chart2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>