
我有一个GrIDVIEw,文本单元格始终垂直填充,
此外,由于某些奇怪的原因,只有当RDA时,才显示属性Refer(可能是RDA或AI),AI似乎不可见(Refer列中的我的表没有空单元格).
请参阅此屏幕截图以更好地了解
使用此方法填充GrIDVIEw
private voID populateGrID(){ Cursor c = dba.getNutrIData(): startManagingCursor(c); String[] from = new String[] { dba.NutrIEnt, dba.Intake, dba.limit, dba.Refer}; int[] to = new int[] { R.ID.txtNutrIEnt, R.ID.txtIntake, R.ID.txtlimit, R.ID.txtRefer}; SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.grID_row, c, from, to); grID.setAdapter(sca);}我使用此GrIDVIEw布局
<GrIDVIEw androID:ID="@+ID/tabellaDIEta" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:fitsSystemwindows="false" androID:gravity="start" androID:numColumns="1" androID:scrollingCache="true" androID:stretchMode="columnWIDth" androID:textAlignment="textStart" > </GrIDVIEw>这是网格布局
<?xml version="1.0" enCoding="utf-8"?><tableLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" > <tableRow androID:layout_gravity="left"> <TextVIEw androID:ID="@+ID/colNome" androID:layout_wIDth="50px" androID:layout_height="wrap_content" androID:layout_gravity="left" androID:layout_weight="1" androID:gravity="left|start" androID:padding="5px" androID:textcolor="@color/white" androID:textSize="12dp" /> <TextVIEw androID:ID="@+ID/colDose" androID:layout_wIDth="50px" androID:layout_height="wrap_content" androID:layout_gravity="left" androID:layout_weight="1" androID:gravity="left|start" androID:padding="5px" androID:textcolor="@color/greenlight" androID:textSize="12dp" ></TextVIEw> <TextVIEw androID:ID="@+ID/collimite" androID:layout_wIDth="50px" androID:layout_height="wrap_content" androID:layout_gravity="left" androID:layout_weight="1" androID:gravity="left|start" androID:padding="5px" androID:textcolor="@color/orange" androID:textSize="12dp" /> <TextVIEw androID:ID="@+ID/colRiferimento" androID:layout_wIDth="50px" androID:layout_height="wrap_content" androID:layout_gravity="left" androID:layout_weight="1" androID:gravity="left|start" androID:padding="5px" androID:textcolor="@color/light_sky" androID:textSize="12dp" ></TextVIEw> </tableRow></tableLayout>解决方法:
此androID:layout_weight =“ 1”的值和androID:padding =“ 5px”这行和androID:numColumns =“ 1”的值很关键.
通过删除重量和填充线并增加列数进行测试
你也已经固定了textVIEw的宽度androID:layout_wIDth =“ 50px”设置为WrapContent
总结以上是内存溢出为你收集整理的GridView布局文本填充问题和空白单元格全部内容,希望文章能够帮你解决GridView布局文本填充问题和空白单元格所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)