Incorrect fragment height in ScrollView
Tried to reproduce Roomorama's nice Availability page, with multiple,
scrollable Caldroid fragments:
https://www.dropbox.com/s/0kpb8435ffv1psp/Screenshot_2013-08-26-18-17-53.png
If I add multiple Caldroid fragments to a LinearLayout that's fine, no
problem at all. BUT if I embed it into a ScrollView, height will be
messed, and I'll get this:
https://www.dropbox.com/s/g3ntnkrnr8shbbv/Screenshot_2013-08-26-17-57-54.png
layout/date_chooser.xaml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:id="@+id/root"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
src/.../DataChooser.java
...
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.date_chooser);
ArrayList<CaldroidFragment> caldroidFragments = new
ArrayList<CaldroidFragment>();
for (int i = 0; i < 12; i++)
caldroidFragments.add(buildCaldroidFragment());
FragmentTransaction t = getSupportFragmentManager().beginTransaction();
for (CaldroidFragment caldroidFragment2 : caldroidFragments)
t.add(R.id.root, caldroidFragment2);
t.commit();
}
...
Here you can find the relevant code snippet:
https://gist.github.com/gabororosz/6343558
Do you have any idea, or workaround?
Thank you!
No comments:
Post a Comment