[英]how to add gridview in betwwen two edittext in android
i am working on an app notebook app in which I want to add pictures to the note. 我正在开发一个应用笔记本应用,我想在其中添加图片。 Please look at the screenshots and also how to scroll gridview and both edit text. 请查看屏幕截图,以及如何滚动gridview和编辑文本。
enter image description here 在此处输入图片说明
This is the XML code of mine. 这是我的XML代码。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="com.app.pb.privatenotebook.NoteBrief">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="15dp"
android:id="@+id/linearLayout"
android:layout_marginBottom="80dp"
>
<EditText
android:id="@+id/et_sub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:ems="10"
android:hint="Subject"
android:textSize="14sp"
android:gravity="start"
android:maxLines="1"
android:inputType="textPersonName"
android:padding="10dp" />
<EditText
android:id="@+id/et_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:ems="10"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:textSize="16sp"
android:padding="10dp"
android:gravity="start"
android:hint="Note"
android:background="@color/colorPrimary"
/>
</LinearLayout>
<TextView
android:id="@+id/tv_cre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/linearLayout"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/linearLayout"
android:layout_marginBottom="54dp"
android:text="TextView" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="com.app.pb.privatenotebook.NoteBrief">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="15dp"
android:id="@+id/linearLayout"
android:layout_marginBottom="80dp"
>
<EditText
android:id="@+id/et_sub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:ems="10"
android:hint="Subject"
android:textSize="14sp"
android:gravity="start"
android:maxLines="1"
android:inputType="textPersonName"
android:padding="10dp" />
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:columnWidth="90dp"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
<EditText
android:id="@+id/et_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:ems="10"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:textSize="16sp"
android:padding="10dp"
android:gravity="start"
android:hint="Note"
android:background="@color/colorPrimary"
/>
</LinearLayout>
<TextView
android:id="@+id/tv_cre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/linearLayout"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/linearLayout"
android:layout_marginBottom="54dp"
android:text="TextView" />
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.