Ronald Scholten
Lurker
Good day to all.
I am reading a tutorial book on how to build android apps.
I am now on the section: Building a Menu with LinearLayout.
It told me to make a new project With the empty activity templet.
With the name main_menu Root element LinearLayout Source set Main.
Then i had to add to the main_menu.xml In design mode A TextView to the UI.
Now when i run the app in the instant it should already show me the title and the text menu under it.
But it only shows me the blue title and no text field.
I wend on with the book hoping it will be sol-ft.
I had to add Menu and 50sp and center horizontal to it.
Then i had to add a multi-line TextView to the UI.
Added text to it, And run the app again.
No menu ore text view.
I also had copy and paset the code from main_menu.xml to activity_main.xml in the hope that that would help.
main_menu.xml
activity_main.xml
I am using android studio 4.0.1
Hope you can help me with this.
I am reading a tutorial book on how to build android apps.
I am now on the section: Building a Menu with LinearLayout.
It told me to make a new project With the empty activity templet.
With the name main_menu Root element LinearLayout Source set Main.
Then i had to add to the main_menu.xml In design mode A TextView to the UI.
Now when i run the app in the instant it should already show me the title and the text menu under it.
But it only shows me the blue title and no text field.
I wend on with the book hoping it will be sol-ft.
I had to add Menu and 50sp and center horizontal to it.
Then i had to add a multi-line TextView to the UI.
Added text to it, And run the app again.
No menu ore text view.
I also had copy and paset the code from main_menu.xml to activity_main.xml in the hope that that would help.
main_menu.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Menu"
android:textSize="50sp" />
<EditText
android:id="@+id/editTextTextMultiLine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
android:text="Select a layout type to view an example. The onClick atribute of each button will call a method which executes setContentView to load the new layout." />
</LinearLayout>
Code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
I am using android studio 4.0.1
Hope you can help me with this.