栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Android-在网格视图行内单击

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Android-在网格视图行内单击

改变你XML,我已经在下面测试了xml它的工作原理GridView

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:foreground="?android:attr/selectableItemBackground"    android:orientation="horizontal"    app:cardCornerRadius="5dp"    app:cardElevation="3dp"    app:cardPreventCornerOverlap="false"    app:cardUseCompatPadding="true">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:focusable="false"        android:orientation="horizontal">        <com.mikhaellopez.circularimageview.CircularImageView android:id="@+id/imgFood" android:layout_width="80dp" android:layout_height="80dp" android:layout_margin="10dp" app:civ_border_color="#ffffff" app:civ_border_width="2dp" app:civ_shadow="true" app:civ_shadow_color="#000000" app:civ_shadow_radius="10" />        <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center_vertical" android:layout_weight="1" android:gravity="center_horizontal|center_vertical" android:orientation="vertical"> <TextView     android:id="@+id/txtName"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_marginLeft="5dp"     android:layout_marginStart="5dp"     android:text="Name"     android:textAppearance="?android:attr/textAppearanceLarge"     android:textSize="16sp" /> <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal">     <TextView         android:id="@+id/currentid"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/txtName"         android:layout_marginLeft="5dp"         android:layout_marginStart="5dp"         android:text="Current ID : "         android:visibility="visible" />     <TextView         android:id="@+id/studentid"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/txtName"         android:layout_marginEnd="30dp"         android:layout_marginRight="30dp"         android:layout_toRightOf="@+id/currentid"         android:text="ID"         android:textAppearance="?android:attr/textAppearanceLarge"         android:textSize="16sp" /> </LinearLayout>        </LinearLayout>        <LinearLayout android:layout_width="30dp" android:layout_height="30dp"> <Button     android:id="@+id/editit"     android:layout_width="30dp"     android:layout_height="30dp"     android:layout_gravity="end"     android:background="@android:drawable/btn_dialog"     android:focusable="false" />        </LinearLayout>    </LinearLayout></android.support.v7.widget.CardView>

您的Grid View XML将如下所示。

<GridView        android:id="@+id/grid"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:focusable="true">    </GridView>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/574700.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号