Create the listview in one activity then on item click open another activity and pass the string to the new activity then in the new activity set the passed string as the text in the text view as for the zoom controls I recommend just increasing And decreasing the font if it is just The text you are zooming in and out on. If you need help with the code just ask and I'll do my best to steer you in the the direction.
Alright here you go not sure if this is exactly what your looking for but at least its a start:
activity_main.xml
="1.0"="utf-8"
<RelativeLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.karthikvambakad.myapplication.MainActivity"
tools:showIn="@layout/activity_main">
<ListView
android:id="@+id/mainListView"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</RelativeLayout>
MainActivity.class
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
ListView myListView;
List<String> your_array_list = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myListView = (ListView)findViewById(R.id.mainListView);
your_array_list.add("test1");
your_array_list.add("test2");
your_array_list.add("test3");
your_array_list.add("test4");
your_array_list.add("test5");
your_array_list.add("test6");
your_array_list.add("test7");
your_array_list.add("test8");
your_array_list.add("test9");
your_array_list.add("test10");
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
MainActivity.this,
android.R.layout.simple_list_item_1,
your_array_list );
myListView.setAdapter(arrayAdapter);
myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String paragraph = "";
if(myListView.getItemAtPosition(position).toString().trim().equals("test1")){
paragraph = "your paragraph for test1 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test2")){
paragraph = "your paragraph for test2 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test3")){
paragraph = "your paragraph for test3 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test4")){
paragraph = "your paragraph for test4 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test5")){
paragraph = "your paragraph for test5 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test6")){
paragraph = "your paragraph for test6 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test7")){
paragraph = "your paragraph for test7 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test8")){
paragraph = "your paragraph for test8 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test9")){
paragraph = "your paragraph for test9 goes here";
}
else if(myListView.getItemAtPosition(position).toString().trim().equals("test10")){
paragraph = "your paragraph for test10 goes here";
}
else {
paragraph = "no value set";
}
Intent i = new Intent(MainActivity.this, DisplayActivity.class);
i.putExtra("paragraph", paragraph);
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
activity_display.xml
="1.0"="utf-8"
<RelativeLayout 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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.karthikvambakad.myapplication.DisplayActivity"
tools:showIn="@layout/activity_display">
<TextView
android:id="@+id/displayTextView"
android:layout_width="match_parent"
android:layout_height="450dp" />
<ZoomControls
android:id="@+id/textZoomControl"
android:layout_width="match_parent"
android:gravity="center"
android:layout_below="@+id/displayTextView"
android:layout_height="wrap_content"></ZoomControls>
</RelativeLayout>
DisplayActivity.class
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.ZoomControls;
public class DisplayActivity extends AppCompatActivity {
String paragraphString = "";
TextView displayTextView;
ZoomControls textZoomControls;
float textSize = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display);
displayTextView = (TextView) findViewById(R.id.displayTextView);
textZoomControls = (ZoomControls) findViewById(R.id.textZoomControl);
Intent intent = getIntent();
paragraphString = intent.getExtras().getString("paragraph");
displayTextView.setText(paragraphString);
textSize = displayTextView.getTextSize();
textZoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textSize++;
displayTextView.setTextSize(textSize);
}
});
textZoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textSize--;
displayTextView.setTextSize(textSize);
}
});
}
}
Hopefull that gets you started if you have any questions or ideas to better the code feel free to contact me and ill do my best to helpout.