============ Problem Description ============
To listveiw fill the item layout is Wrap_content,listview itself also uses wrap_content, but the actual display effect ListView width is full screen, seek solution
Item Layout:
<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "wrap_content "Android:layout_height=" wrap_content "><textview android:id=" @+id/video_name "android:layout_width=" WR Ap_content "android:layout_height=" wrap_content "android:textcolor=" #ffffff "/></relativelayout>
ListView Layout:
<relativelayout android:id= "@+id/video_list_box" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:background= "@drawable/list_bg" android:layout_ Alignparentright= "true" android:layout_below= "@id/title_box" > < Listview android:id= "@+id/video_list_view" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" ></ Listview> </relativelAyout>
============ Solution 1============
Layout This kind of thing in a single case fortunately said, once combined, the various layouts are nested in each other is not easy to find the law, need to slowly adjust
You put the whole layout file up and see
============ Solution 2============
You can control the width in the code, first take out the width and height of the screen to set
============ Solution 3============
Reference 5 Floor Augleo1989 's reply:
Main layout:
<relativelayout 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" tools:context= ". Mainactivity " > <RelativeLayout android:id= "@+id/video_list_box" android:layout_width= "Wrap_content" android:layout_ height= "Wrap_content" android:background= "@drawable/list_bg" android:layout_alignparentright= "true" > <ListView &nbSp; android:id= "@+id/video_list_view" android: Layout_width= "Wrap_content" android:layout_height= " Wrap_content " ></ListView> </RelativeLayout></RelativeLayout>
Item Layout:
<?xml version= "1.0" encoding= "Utf-8"? ><relativelayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Wrap_content "android:layout_height=" wrap_content "><textview android:id = "@+id/video_name" android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:textColor= "#f Fffff "/></relativelayout>
The effect is to display a list of menus on the right side of the screen, with the LIST_BG consistent with the background image.
You set the width of the ListView to 200DP to set the item value to 100DP to see if you can achieve the effect you want, if not, the description is Android internal mechanism problem
Control the listview width and height in Android