如何在ListView Android中添加页眉和页脚间距?

时间:2014-09-17 10:06:59

标签: android listview

请。我想知道如何在ListView android中添加页眉和页脚间距。我的目标是制作一个标题,我将把Gmail手机应用程序中的帐户信息(姓名,图片......)放在导航栏中。这是一个屏幕示例http://i.imgur.com/58GsTej.jpg

我的导航抽屉适配器:

 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 个答案:

没有答案