简体   繁体   中英

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. 在此处输入图片说明

在此处输入图片说明

enter image description here 在此处输入图片说明

This is the XML code of mine.

 <?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM