Every time I get my toolbar at every text place in my listview. I don't know how to resolve this. I paste my layout file and My java file below. Is possible to generate an OTP of any contact number like 1234567890. The first question is important.
my xml file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#FF6E26"
android:minHeight="?attr/actionBarSize">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/app_name"
android:textColor="#ffffff"
android:typeface="sans"
android:textSize="20sp"
android:textStyle="bold"
android:gravity="center_vertical" />
</android.support.v7.widget.Toolbar>
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
/>
<TextView
android:id="@+id/textViewList"
android:layout_width="match_parent"
android:layout_height="30dp"
android:textColor="#ffff66"
android:textSize="20sp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
My code is:
public class ContactList extends Activity {
String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry","WebOS","Ubuntu","Windows7","Max OS X"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_contact);
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.list_contact, R.id.textViewList, mobileArray);
ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);
}
}
