I am trying to make a m-learning app and in this app I have a activity in witch the user reads text . After I made the activity scrollable i stumbled apon a supid basic problem ... how do i add the text to the activity ? I don't know if i need to use TextView and if yes then how do I modify it to show all the text I need. I will put below all the code:
-activity java :
public class displayCursI extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_curs_i);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}
- activity xml :
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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.andrei.licenta_3.displayCursI"
tools:showIn="@layout/activity_display_curs_i">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="132dp"
android:layout_marginTop="105dp"
android:text="@string/text"
android:textAlignment="center" />
</ScrollView>
- string xml
<string name="app_name">Licenta_3</string>
<string name="action_settings">Settings</string>
<string name="button_cursuri">Cursuri</string>
<string name="button_chestionar">Chestionar</string>
<string name="title_activity_display_cursuri">displayCursuri</string>
<string name="button_I">I</string>
<string name="button_II">II</string>
<string name="button_III">III</string>