2013-12-04 3 views
0

У меня, вероятно, отсутствует что-то очень простое здесь, но я не могу, чтобы жизнь меня видна.Android ScrollView не прокручивает автоматически

Я пытаюсь заставить ScrollView работать в приложении для Android. Хотя макет выглядит хорошо, текст/изображение не будут прокручиваться автоматически

<LinearLayout 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:orientation="vertical" 
> 
<ScrollView 
    android:focusable="true" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:background="#f7f7f7" 
    android:layout_weight="1" 
    android:fillViewport="true" 
    android:orientation="vertical" 
    android:padding="25dp" > 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     tools:context=".NasaDailyImage" > 
     <TextView 
      android:id="@+id/imageTitle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/test_image_title" /> 
     <TextView 
      android:id="@+id/imageDate" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/test_image_date" /> 
     <ImageView 
      android:id="@+id/imageDisplay" 
      android:contentDescription="@string/test_image_description" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:adjustViewBounds="true" 
      android:src="@drawable/test_image" /> 
     <TextView 
      android:id="@+id/imageDescription" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/test_image_description" /> 
    </LinearLayout> 
</ScrollView> 
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:gravity="center" 
     android:layout_weight="0"> 
     <Button android:text="@string/refresh" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:padding="5dp" 
      android:background="#ff8D8D8D" 
      android:onClick="refreshScreen" 
      android:gravity="center"/> 
    </LinearLayout> 
</LinearLayout> 

Есть ли у кого-нибудь идеи?

ответ

0

Дайте некоторую высоту для прокрутки, как 100dp. Добавьте еще несколько текстовых просмотров. Она будет работать

+0

Спасибо - я попытался это тоже, но это не имеет никакого значения. –

0
<ScrollView 
    android:focusable="true" 
    android:layout_width="fill_parent" 
    **android:layout_height="fill_parent"** 
    android:background="#f7f7f7" 
    android:layout_weight="1" 
    android:fillViewport="true" 
    android:orientation="vertical" 
    android:padding="25dp" /> 

просто fill_parent к вашей прокрутке высоте вида, что чувак

+0

Я пробовал ваше предложение, но оно не имело никакого эффекта :( –

+0

ooooo не закрыть это как «/>» просто используйте экземпляр «/>» для «>» и закройте это после завершения вашего прокрутки. –

+0

Спасибо за ваш ответ , но тег уже установлен на «>» в ​​соответствии с моим кодом выше. –

Смежные вопросы