I am not able add different views inside a scrollview. How can I add a textView and a editText inside a scrol开发者_运维百科lView
Yes you can add. But use a Layout and put your components there.
Example <ScrollView><LinearLayout> *Views* </LinearLayout></ScrollView>
Sample Code
<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/innerly1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/heading1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/background_light"
android:gravity="center"
android:scrollbars="vertical"
android:textColor="#FF0000" />
<ImageView
android:id="@+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/desc1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/background_light"
android:gravity="center"
android:scrollbars="vertical"
android:textColor="#FF0000" />
</LinearLayout>
</ScrollView>
精彩评论