0

Я не могу найти ответа на этот вопрос, у меня есть деятельность, в которой макет содержит (в этом порядке) TextView, a ImageView и ScrollView. В этом ScrollView есть RelativeLayout, который содержит несколько вещей. Вот мой кодСделать прокруткуПросмотреть всю деятельность

<RelativeLayout 
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:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:background= "#7a9965" 
tools:context="pact.smartpen.AboutActivity"> 

<TextView 
    android:text="À propos de" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView" 
    android:layout_centerHorizontal="true" 
    android:typeface="serif" 
    android:textSize="30dp"/> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="250dp" 
    android:layout_height="150dp" 
    android:src="@drawable/sp" 
    android:layout_below="@+id/textView" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" /> 

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" 
    android:id="@+id/scrollView" 
    android:layout_below="@+id/imageView1"> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 


      <TextView 
       android:text="Cette application a été développée par 9 élèves de l'école Télécom ParisTech dans le cadre du projet PACT \n \n Arnaud Bonetti \n Oumayma Bounou \n Quentin Chabert \n Benoit Colas \n Fatimata Fall \n Anthony Hu \n Guillaume Grelet \n Louis Marty \n Nicolas Pontois \n \n \n Le code est disponible sur GitHub à l'adresse suivante :\n " 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/textView2" 
       android:gravity="center_horizontal" 
       android:typeface="serif" 
       android:textSize="24dp" 
       android:layout_alignParentEnd="true" /> 

      <TextView 
       android:text="https://github.com/PACT11/SmartPen.git \n \n" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:autoLink="web" 
       android:id="@+id/textView3" 
       android:layout_centerHorizontal="true" 
       android:gravity="center_horizontal" 
       android:layout_below="@id/textView2" 
       android:typeface="serif" 
       android:textSize="18dp"/> 
     </RelativeLayout> 



</ScrollView> 

Проблема заключается в том, что ScrollView не соответствует должным образом на экране, как вы можете видеть на скриншоте:

enter image description here

+0

Вы хотите установить прокрутку для всего макета? –

+1

Удалить прокладки из корневой компоновки – redGREENblue

ответ

1

Erase это от <RelativeLayout>:

android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 

Этот код дает целое дополнение к вашей деятельности.

Надеюсь, это поможет!

1
<RelativeLayout 
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:background= "#7a9965" 
tools:context="pact.smartpen.AboutActivity"> 

<TextView 
    android:text="À propos de" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView" 
    android:layout_centerHorizontal="true" 
    android:typeface="serif" 
    android:textSize="30dp"/> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="250dp" 
    android:layout_height="150dp" 
    android:src="@drawable/sp" 
    android:layout_below="@+id/textView" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" /> 

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" 
    android:id="@+id/scrollView" 
    android:layout_below="@+id/imageView1"> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 


      <TextView 
       android:text="Cette application a été développée par 9 élèves de l'école Télécom ParisTech dans le cadre du projet PACT \n \n Arnaud Bonetti \n Oumayma Bounou \n Quentin Chabert \n Benoit Colas \n Fatimata Fall \n Anthony Hu \n Guillaume Grelet \n Louis Marty \n Nicolas Pontois \n \n \n Le code est disponible sur GitHub à l'adresse suivante :\n " 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/textView2" 
       android:gravity="center_horizontal" 
       android:typeface="serif" 
       android:textSize="24dp" 
       android:layout_alignParentEnd="true" /> 

      <TextView 
       android:text="https://github.com/PACT11/SmartPen.git \n \n" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:autoLink="web" 
       android:id="@+id/textView3" 
       android:layout_centerHorizontal="true" 
       android:gravity="center_horizontal" 
       android:layout_below="@id/textView2" 
       android:typeface="serif" 
       android:textSize="18dp"/> 
     </RelativeLayout> 



</ScrollView> 
Смежные вопросы