2015-11-13 5 views
0

Так что я хочу иметь макет как на картинке: Desired layout Изображение слева, затем название, а затем текст ниже. Я не могу сделать это, имея прокрутку!Как получить этот макет в scrollview?

Так что это мой код, пока не используется Scrollview:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<ImageView 
    android:id="@+id/imageViewH" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:src="@drawable/header" /> 

      <TextView 
       android:id="@+id/textViewIntroText" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_below="@+id/imageView1" 
       android:text="@string/intro" /> 

      <ImageView 
       android:id="@+id/imageViewLOGO" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_centerVertical="true" 
       android:src="@drawable/klein" /> 

      <ImageView 
       android:id="@+id/imageViewBlock" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_marginLeft="19dp" 
       android:layout_toRightOf="@+id/imageView3" 
       android:src="@drawable/block" /> 

      <TextView 
       android:id="@+id/textViewBMWText" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_below="@+id/imageView3" 
       android:text="@string/bmwtext" /> 

      <TextView 
       android:id="@+id/textViewBMWTitle" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/textViewIntroText" 
       android:layout_toRightOf="@+id/imageView2" 
       android:text="@string/bmw" /> 

Как я достичь тех же результатов, но с Scrollview?

В любом случае, спасибо за ваше время! Я ценю каждый ответ/комментарий!

+0

Это всегда хорошая идея создать [MCVE] (http://stackoverflow.com/help/mcve). У этого вопроса есть куча лишнего кода, который даже не пытается воспроизвести проблему. Это как пойти к механику с совершенно хорошей машиной, показывая это ему, а затем спросить его, что случилось с вашей разбитой машиной домой. – tachyonflux

ответ

1

Я не имею мой AS рядом со мной, но вы можете попробовать это, пожалуйста:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<ScrollView 
android:layout_height="match_parent" 
android:layout_width="match_parent"> 

<RelativeLayout 
android:layout_height="match_parent" 
android:layout_height="match_parent"> 

//all your xml here 

</RelativeLayout> 
</ScrollView> 
+0

Спасибо! Оно работает! – DyRight

+0

greaaaaaaat! : D – Coeus

0

Установите RelativeLayout в wrap_content. Если вид ребенка имеет тот же размер, что и ScrollView, очевидно, что он не будет прокручиваться.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    </RelativeLayout> 
</ScrollView> 
+0

Хотя я не хочу, чтобы вся страница была scrollview, это то, что я обязательно использую позже! Спасибо! – DyRight