Android : How to add a header and footer spacing in a ListView Android?

on Wednesday, September 17, 2014


Please. i want to know how to added a header and footer spacing in a ListView android. The aim goal is to make a header wich on i will put the account information (Name, surname, picture...) like Gmail mobile app in the navigation drawer. These is a screen example http://i.imgur.com/58GsTej.jpg


My Navigation Drawer Adapter :



mDrawerListView.setAdapter(new ArrayAdapter<String>(getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1,
new String[] {
getString(R.string.title_section1),
getString(R.string.title_section2),
getString(R.string.title_section3),
getString(R.string.title_section4),
getString(R.string.title_section5),
getString(R.string.title_section6)}) {

@Override
public View getView(int position, View convertView, ViewGroup parent) {

TextView textView = (TextView) super.getView(position, convertView, parent);
textView.setTextColor(getResources().getColor(R.color.dark_grey));

//To Set the icones
Drawable image = getResources().getDrawable(R.drawable.spots);
Drawable image2 = getResources().getDrawable(R.drawable.sessions);

textView.setCompoundDrawablesWithIntrinsicBounds( image, null, null, null);


return textView;
}
});


NavigationDrawerLayout :



<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:background="@color/connexion_button"
android:padding="16dip"
android:dividerHeight="15.0sp"
tools:context="com.example.user.unchained.NavigationDrawerFragment"
android:clipToPadding="false"
/>

0 comments:

Post a Comment