android - Make content inside scrollView match display size -
i have scrollview
relativelayout
inside it.
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true"> <relativelayout android:id="@+id/towrap" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background_color">
i want make relativelayout not fill parent, fill display.
i want because when open keyboard, layout gets ugly.
i've tried create expandablerelativelayout
subclass ondraw this:
@override protected void ondraw(canvas canvas) { displaymetrics metrics = resources.getsystem().getdisplaymetrics(); setlayoutparams(new layoutparams(layoutparams.fill_parent, (int)(metrics.heightpixels * metrics.density))); super.ondraw(canvas); }
but received error:
e/androidruntime(15331): java.lang.classcastexception: android.widget.relativelayout$layoutparams cannot cast android.widget.framelayout$layoutparams`
how do that?
thanks.
i think should use relativelayout.layoutparams instead of layoutparams. , didnot have errors. if using ecllipse , altered xml , error occured after should close ecllipse , start again. bug in ecllipse @ point r.java stops generating , classcastexception occurs.
Comments
Post a Comment