많은 관련 문제가 있다는 것을 알고 있지만 구체적인 대답을 찾고 있습니다. 아래의 코드는 앱에서 주로 사용하는 XML입니다. 이제 내 질문. 수평 뷰의 내용을 동적으로 변경할 수 있어야합니다. 여기에는 Views를 삭제하고 새로운보기를 추가하는 작업이 포함됩니다. 선형 레이아웃에 ID를 할당하려 할 때 유형 문자열 ID를 수락 할 수 없다는 오류가 발생하면서 정확히 어떻게이 작업을 수행 할 것인가?가로 스크롤 한 어린이보기 (Eclipse IDE, Android)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/txtClassification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Classification:<>"
android:textAppearance="?android:attr/textAppearanceLarge"
tools:ignore="HardcodedText" />
<Spinner
android:id="@+id/spinGoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="56dp" />
<Button
android:id="@+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Go Back"
tools:ignore="HardcodedText" />
<Button
android:id="@+id/btnSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Select"
tools:ignore="HardcodedText" />
<HorizontalScrollView
android:id="@+id/gallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtClassification"
android:layout_alignRight="@+id/spinGoto"
android:layout_below="@+id/txtClassification" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<ImageView
android:id="@+id/myImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>
모든 도움을 주실 수 있습니다. HorizontalScrollView
는 하나의 직접 아이를 가질 수 있기 때문에