我在这做错了什么?
我让GrIDVIEw背景比片段背景暗一点.
我的代码:
布局/ fragment.xml之:
<androID.support.constraint.ConstraintLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res-auto" xmlns:tools="http://schemas.androID.com/tools" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:background="#ADD178" tools:context="com.example.myapp.Fragment" androID:ID="@+ID/constraintLayout"><androID.support.v7.Widget.CardVIEw androID:ID="@+ID/current_card" androID:layout_wIDth="73dp" androID:layout_height="89dp" app:cardBackgroundcolor="#E917BC" app:layout_constraintleft_toleftOf="@+ID/constraintLayout" androID:layout_marginStart="16dp" app:layout_constrainttop_totopOf="@+ID/constraintLayout" androID:layout_margintop="16dp"> <TextVIEw androID:ID="@+ID/current_card_letter" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:textSize="40dp" androID:gravity="center" androID:textcolor="#000000" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="0dp"/> </androID.support.v7.Widget.CardVIEw><GrIDVIEw androID:ID="@+ID/all_cards_grID_vIEw" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:numColumns="auto_fit" androID:columnWIDth="60dp" androID:horizontalSpacing="5dp" androID:verticalSpacing="5dp" androID:stretchMode="spacingWIDthUniform" androID:background="#30000000" app:layout_constraintleft_toleftOf="@+ID/constraintLayout" androID:layout_marginStart="8dp" app:layout_constrainttop_toBottomOf="@+ID/current_card" androID:layout_margintop="8dp" app:layout_constraintRight_toRightOf="@+ID/constraintLayout" androID:layout_marginEnd="8dp" app:layout_constraintBottom_toBottomOf="@+ID/constraintLayout" androID:layout_marginBottom="8dp"/></androID.support.constraint.ConstraintLayout>
来自适配器的getVIEw:
@OverrIDepublic VIEw getVIEw(final int position,VIEw convertVIEw,VIEwGroup parent) { TextVIEw textVIEw; if (convertVIEw == null) { textVIEw = new TextVIEw(mContext); textVIEw.setpadding(CARD_padding,CARD_padding,CARD_padding); textVIEw.setLayoutParams(new GrIDVIEw.LayoutParams(160,160)); textVIEw.setTextSize(40); textVIEw.setTextcolor(color.BLACK); textVIEw.setGravity(Gravity.CENTER); } else { textVIEw = (TextVIEw) convertVIEw; } textVIEw.setBackgroundResource(getItem(position).getthumbnailID()); textVIEw.setText(getItem(position).getLetter()); return textVIEw;}解决方法 删除androID:layout_marginStart和androID:layout_marginEnd属性,它们将停止被推到边界之外. 总结
以上是内存溢出为你收集整理的Android GridView最后一栏被削减全部内容,希望文章能够帮你解决Android GridView最后一栏被削减所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)