Tranquilo Matheus, segue abaixo os códigos:
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.anima.agenda">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".FormularioActivity"
android:label="@string/title_activity_formulario"
android:theme="@style/AppTheme.NoActionBar">
</activity>
</application>
</manifest>
Activity:
package br.com.anima.agenda;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String[] alunos= {"Tharles", "Andressa", "Joao"};
ListView listaA = (ListView) findViewById(R.id.lista_alunos);
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,alunos);
listaA.setAdapter(adapter);
Button novoAluno = (Button)findViewById(R.id.novo_aluno);
novoAluno.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent goToForm = new Intent(MainActivity.this,FormularioActivity.class);
startActivity(goToForm);
}
});
}
}
Layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="150px"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nome"
android:id="@+id/formulario_nome"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Endereco"
android:id="@+id/formulario_endereco"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Site"
android:id="@+id/formulario_site"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:numStars="5"
android:max="10"
android:id="@+id/formulario_rating"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Salvar"
android:id="@+id/formulario_salvar"/>
</LinearLayout>
</ScrollView>