我在Frame Layout中创建了ListView项目:
home_activity.xml:
<FrameLayout 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=".Home">
<ListView
android:id="@+id/home_item_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
</ListView>
</FrameLayout>
home_list_item.xml:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_item_activity_selector_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingLeft="15dp"
/>
我的问题是ListView项目不是屏幕宽度的100%,只是标签的宽度
我需要改变什么?
答案 0 :(得分:1)
在android:layout_width="wrap_content"
更改
android:layout_width="match_parent"
到
var checkBoxTemplate = '<div class="ngCellText text-center" ng-cell-text ng-class="col.colIndex()" ' +
'style="height: 100%;vertical-align: middle"> ' +
' <span ng-show="COL_FIELD" class="glyphicon glyphicon-ok" style="margin-top: 6px;"/> ' +
'</div> ';
答案 1 :(得分:0)
尝试删除android:gravity="center_vertical"
上的ListView
并在android:layout_width="match_parent"
上设置wrap_content
而不是TextView
。