android5.1

### oefening 1 ###

<?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>



Download hier het bestand.
### oefening 2 ###

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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!" />

</LinearLayout>

Download hier het bestand.
### oefening 3 ###

<androidx.constraintlayout.widget.ConstraintLayout...">

    ...
  
    <androidx.gridlayout.widget.GridLayout...>
  
        ...

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ListView"
            android:onClick="startListViewActivity"
            app:layout_row="0"
            app:layout_column="0"
            app:layout_gravity="fill"
            app:layout_columnWeight="1"
            app:layout_rowWeight="1" />
        
        ...
       
    </androidx.gridlayout.widget.GridLayout>
    
    ...

</androidx.constraintlayout.widget.ConstraintLayout>

Download hier het bestand.
### oefening 4 ###

### activity_list_view.xml ###

<androidx.constraintlayout.widget...>

	...

    <ListView
        android:id="@+id/listView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:layout_editor_absoluteX="1dp"
        tools:layout_editor_absoluteY="1dp" />

    ...

</androidx.constraintlayout.widget.ConstraintLayout>

### ListViewActivity.java ###

public class ListViewActivity extends AppCompatActivity {

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

        ...

        ListView listView = (ListView)findViewById(R.id.listView);

        final ArrayList<String> arrStudenten = new ArrayList<String>();

        arrStudenten.add("Joep");
        arrStudenten.add("Cris");
        arrStudenten.add("Floris");

        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, arrStudenten);

        listView.setAdapter(arrayAdapter);

        ...
    }
}

### MainActivity.java ###

public class MainActivity extends AppCompatActivity {

    ...




    ...
}

Download hier het bestand.