我想將imageview放在android studio的scrollview中,但它不會讓我在scrollview中拖放imageview。不能把imageview在滾動視圖android studio
這裏是我的代碼:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ccc"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="30dp">
<LinearLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#ffffff"
android:gravity="center"
android:orientation="vertical"
android:textColor="#ffffff">
<TextView
android:id="@+id/homepagetxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:textColor="#000000"
android:textStyle="italic" />
</LinearLayout>
</ScrollView>
我可以把它放在線性佈局,但它打亂了我的屏幕布局。 但是,我不能像在linearlayout結束標記之後那樣將它放在滾動視圖中。
將imageview放在scrollview中是否有任何限制?
我很感激你的迴應。
哦..我可以有一個線性佈局,包含另一個線性佈局和滾動視圖嗎? –
是的,因爲線性(或相對)佈局可以包含多個直接子對象,但滾動視圖只能有一個直接子對象。 –
非常感謝你,幫了我很多。 –