2017-09-17 4 views
0

J'ai essayé de faire une application mobile. Mais l'image ne s'affiche pas sur le téléphone lorsque le programme est exécuté sur le téléphone. Et scrollview ne défile pas. Votre aide sera très appréciée. Merci beaucoup pour votre temps.L'image ne s'affiche pas et ScrollView ne défile pas dans Android

This is the output that I want. The picture part is the yellow box with text, the one with the id "header". Thank you.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_car_matcher" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:paddingBottom="0dp" 
android:paddingLeft="0dp" 
android:paddingRight="0dp" 
android:paddingTop="0dp" 
android:fillViewport="true" 
tools:context="ph.com.steamrise.goodrides.CarMatcherActivity" 
android:background="@drawable/carmatcher"> 


    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="140dp"> 

      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="140dp" 
       app:srcCompat="@drawable/header" 
       android:id="@+id/imageView" 
       /> 


     </LinearLayout> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="#80ffffff" 
      android:orientation="vertical" 
      > 
      <TextView 
       android:text="1. What's your ideal vacation?" 
       android:layout_width="190dp" 
       android:layout_height="wrap_content" 
       android:textColor="#FF000000"/> 
      <RadioGroup 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

       <RadioButton 
        android:text="Climbing the rocky mountains" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton11" 
        android:layout_weight="1" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="Road trip at the city with family" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton12" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="Enjoying the view on top of the mountain with friends" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton13" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="Explore random places alone or with my partner" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton14" 
        android:textSize="12dp"/> 
      </RadioGroup> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:background="#80FFFFFF"> 
      <TextView 
       android:text="2. How would you describe your style?" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:textColor="#FF000000"/> 
      <RadioGroup 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

       <RadioButton 
        android:text="Sporty" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton15" 
        android:layout_weight="1" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="Casual" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton16" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="Elegant" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton17" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="Free-spirited" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton18" 
        android:textSize="12dp"/> 
      </RadioGroup> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:background="#80FFFFFF"> 
      <TextView 
       android:text="2. How are you with money?" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:textColor="#FF000000"/> 
      <RadioGroup 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

       <RadioButton 
        android:text="Really Careful- I prefer cheap stuff as long is it is usable" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton19" 
        android:layout_weight="1" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="I'm saving every penny and cutting corners where I can. Wait.. are you going to throw that empty can out? " 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton20" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="I’m more of a “spend now, regret later” person. What’s the point of having money if you’re not going to spend it? " 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton21" 
        android:textSize="12dp"/> 
       <RadioButton 
        android:text="d) I’m a little risky with my money. I love playing stock market- and don’t worry, those pumpkin stocks will go up any time now" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/radioButton22" 
        android:textSize="12dp"/> 
      </RadioGroup> 

     </LinearLayout> 



    </LinearLayout> 

Répondre

0

Votre première LinearLayout (qui doit être l'enfant SEULEMENT du ScrollView) doit être wrap_content en hauteur, il peut donc être plus grand que le défilement

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

Et votre en-tête ImageView utiliser android: src = "@ drawable/header" au lieu de l'application: srcCompat = "@ drawable/header"