Problems with Scroll View, how to solve?

Asked

Viewed 319 times

0

Good morning, I’m new with Android programming and I’m trying to develop an application in which, depending on the subject that the user choose will open a certain screen, but every time the application tries to open this page with the materials, it hangs. I think the problem is with Scrooll View because the other screens that do not have, work normally, in the preview of Android Studio it appears to be normal, when I slide with the mouse the screen slides and so when rotating on the device things are different,Anyway, I appreciate it if anyone can help.

Print da tela que apresenta a falha

XML code, currently it is with Scroolview Layout

<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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.caio.orculodosaber.pp"
tools:ignore="contentDescription"
android:focusable="true"
android:focusableInTouchMode="true">

 <LinearLayout
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_marginTop="10dp"
     android:orientation="vertical">

                  <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal">


                         <ImageButton
                                android:id="@+id/imageButtonArte"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="10dp"
                                android:background="@color/transparente"
                                android:scaleType="fitXY"
                                app:srcCompat="@drawable/icone_arte"
                                android:clickable="true"
                                android:onClick="obras"/>



                        <ImageButton
                                android:id="@+id/imageButtonBiologia"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="40dp"
                                android:background="@color/transparente"
                                android:scaleType="fitXY"
                                android:clickable="true"
                                app:srcCompat="@drawable/icone_biologia"
                                android:onClick="obras"/>

                </LinearLayout>

                 <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                        <ImageButton
                                android:id="@+id/imageButtonFilosofia"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="10dp"
                                android:layout_marginTop="10dp"
                                android:scaleType="fitXY"
                                android:background="@color/transparente"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_filosofia"/>

                        <ImageButton
                                android:id="@+id/imageButtonFisica"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="40dp"
                                android:layout_marginTop="10dp"
                                android:background="@color/transparente"
                                android:scaleType="fitXY"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_fisica" />

                </LinearLayout>

                 <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                        <ImageButton
                                android:id="@+id/imageButtonGeografia"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="10dp"
                                android:background="@color/transparente"
                                android:layout_marginTop="10dp"
                                android:scaleType="fitXY"
                                android:visibility="visible"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_geografia" />

                        <ImageButton
                                android:id="@+id/imageButtonHistoria"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="40dp"
                                android:background="@color/transparente"
                                android:layout_marginTop="10dp"
                                android:scaleType="fitXY"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_historia" />

                 </LinearLayout>

                <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                        <ImageButton
                                android:id="@+id/imageButtonMatematica"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="10dp"
                                android:background="@color/transparente"
                                android:layout_marginTop="10dp"
                                android:scaleType="fitXY"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_matematica" 
                                   />

                        <ImageButton
                                android:id="@+id/imageButtonPortugues"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="40dp"
                                android:background="@color/transparente"
                                android:layout_marginTop="10dp"
                                android:scaleType="fitXY"
                                app:srcCompat="@drawable/icone_portugues"
                                android:clickable="true"
                                android:onClick="obras"/>
                </LinearLayout>


                      <LinearLayout
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
                         android:orientation="horizontal">

                              <ImageButton
                                android:id="@+id/imageButtonQuimica"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginLeft="10dp"
                                android:background="@color/transparente"
                                android:layout_marginTop="10dp"
                                android:scaleType="fitXY"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_quimica" />

                              <ImageButton
                                android:id="@+id/imageButtonSociologia"
                                android:layout_width="160dp"
                                android:layout_height="160dp"
                                android:layout_marginTop="10dp"
                                android:layout_marginLeft="40dp"
                                android:background="@color/transparente"
                                android:scaleType="fitXY"
                                android:clickable="true"
                                android:onClick="obras"
                                app:srcCompat="@drawable/icone_sociologia" />

                      </LinearLayout>



        </LinearLayout>

</ScrollView>

Code gives java:

 import android.content.Intent;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.Toast;

 public class pp extends AppCompatActivity {

     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_pp);


    }
  • Locks and closes? What error is showing in Android Studio?

  • It in Android Studio does not appear any error, as if it was ok, but when running on mobile appears that the app presented flaws continuously when opening this screen, and then it hangs

  • You have to open the Logcat and see the error it presents when it crashes. Put this error in the question.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.