次の線形レイアウトがあり、それを子として HorizontalScrollView に設定しています
ファイル menu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menu"
android:orientation="vertical" android:background="#2f4f4f" android:layout_width="wrap_content" android:layout_height="fill_parent">
<ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="#2f4f4f" android:cacheColorHint="#2f4f4f" android:scrollbars="none">
</ListView>
</LinearLayout>
ファイル: scrollview.xml
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#00ffffff" android:padding="0px"
android:layout_margin="0px" android:fadingEdge="none" android:fadingEdgeLength="0px" android:scrollbars="none">
<LinearLayout android:id="@+id/top" android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="horizontal" android:background="#ffffffff" android:padding="0px" android:layout_margin="0px">
</LinearLayout>
</HorizontalScrollView>
プログラムで線形レイアウトの幅を設定しようとしていますが、ClassCastException が発生しています。(LinearLayout$LayputParams は FrameLayout$LayputParams にキャストできません)
LayoutInflater inflater = LayoutInflater.from(this);
scrollView = inflater.inflate(R.layout.scrollview_xml, null);
setContentView(scrollView);
View menu = inflater.inflate(R.layout.menu_xml, null);
scrollView.addView(menu);
scrollView.getChildAt(0).setLayoutParams(new ViewGroup.LayoutParams(100,100));
これを解決するには?