직접 아이가, 내가 사용하려고 코드가 호스팅 할 수 있습니다 하나의 직접 자식있는 ScrollView는 하나의 내가있는 ScrollView에 이미지를 추가 할 예외
그래서 내 scrollview에 이미지를 추가해야합니까?
추가 코드 : XML :
공공 무효 addImage (문자열 경로) {
LinearLayout sv = (LinearLayout)findViewById(R.id.filesScrollerLayout);
ImageView iv = new ImageView(this);
iv.setImageDrawable(new BitmapDrawable(path));
iv.setScaleType(ScaleType.CENTER_INSIDE);
sv.addView(sv);
}
감사 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#FF0000" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
</ScrollView>
<ScrollView
android:id="@+id/scrollView2"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/scrollView1"
android:background="#FFFF00" >
<LinearLayout
android:id="@+id/filesScrollerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
</ScrollView>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="250dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#FFFFFF"
android:layout_toRightOf="@+id/scrollView2" />
</RelativeLayout>
그리고 결국 활동에서 onCreate이 메서드를 호출에
.
'다른 모든보기를 호스팅 한 아이 ..
필요 sv.addView (sv)'가 잘못되었습니다. 그 진술에 대한 이유가 있습니까? – Rajesh
그냥 scrollView에 이미지를 추가하고 싶습니다. 다른 솔루션이 있습니까? – Streetboy
'sv.addView (iv)'로 변경하십시오. – Rajesh