0
Good morning, I’m new in Android programming and I’m trying to create a program that based on a subject that the user chooses, will open a certain screen, everything I’ve been doing was based on search sites, videos and etc; but when compiling the program and running itlo, it hangs when I click the button to go to the menu (the one from the print), and simply closes. I thought the error could be in the search bar, but I used the same on two other screens and it worked, so I think the problem is in Scrool View. The idea would be to rotate it vertically to display the other subjects and the search bar remain static above. I thank anyone who can help :)
Activity code:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/blue" />
<EditText
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="55dp"
android:background="@color/blue"
android:ems="10"
android:inputType="text"
android:text="@string/textView"
android:labelFor="@id/toolbar2"
android:textColor="@color/black" />
<ImageButton
android:id="@+id/my_account"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBottom="@+id/toolbar2"
android:layout_alignParentRight="true"
android:background="@color/blue"
android:scaleType="fitEnd"
app:srcCompat="@drawable/account"
android:clickable="true"
android:onClick="conta"/>
<ImageButton
android:id="@+id/search_user"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_marginEnd="22dp"
android:layout_marginTop="10dp"
android:layout_toStartOf="@+id/my_account"
android:background="@color/blue"
android:scaleType="fitEnd"
app:srcCompat="@drawable/magnify"
android:clickable="true"
android:onClick="obras"/>
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp">
<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_marginStart="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_marginStart="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_marginStart="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_marginStart="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_marginStart="40dp"
android:background="@color/transparente"
android:scaleType="fitXY"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_sociologia" />
</LinearLayout>
</LinearLayout>
</ScrollView>