[英]Navigation Drawer Android List Item Hight
我為android應用程序制作了一個自定義抽屜,但是存在一個問題,即第一個項目的高度大於所有其他項目。.我的Navigation Drawer的XML代碼是:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- other Layouts here -->
<!-- My custom list here -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#F3F3F4"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" >
</ListView>
</android.support.v4.widget.DrawerLayout>
ListView自定義適配器布局代碼在這里:
<?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="wrap_content"
android:background="#efefef" >
<ImageView
android:id="@+id/icon"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="10dp"
android:contentDescription="@string/desc_list_item_icon"
android:src="@drawable/logout_icon" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/icon"
android:textColor="@color/list_item_title"
android:textSize="13sp" />
<ImageView
android:id="@+id/ivAeroo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@drawable/rightorangearrowicon" />
<View
android:id="@+id/view1"
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ababab" />
</RelativeLayout>
我的版面配置仍使第一個項目像這樣大。
檢查用於ImageView的圖像(id =圖標)。
我很確定它們的大小不一樣。
嘗試
android:layout_height="fill_parent"
代替
android:layout_height="wrap_content"
用於ID =圖標的ImageView
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.