Created
April 24, 2012 17:01
-
-
Save Ginny/2481484 to your computer and use it in GitHub Desktop.
Listview without extending ListActivity because of actionbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeActivity extends MyActionBar { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
ArrayList<String> events = new ArrayList<String>(); | |
events.add("Birthday party"); | |
events.add("Epic party"); | |
events.add("Beach BBQ"); | |
ListView lv = (ListView) findViewById(R.layout.list); | |
lv.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, events)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ListView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/list" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" > | |
</ListView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:padding="10dp" | |
android:textSize="16sp" > | |
</TextView> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment