После этого вы можете реализовать свой адаптер recyclerview следующим образом:

аюсь запустить действие с помощью кнопки внутри моего элемента gridview, то есть, когда пользователь нажимает на элемент gridview, он должен выполнять одну функцию, а когда пользователь нажимает кнопку внутри элемента 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">

<RelativeLayout
    android:id="@+id/single_row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingTop="10dp">

    <com.mikhaellopez.circularimageview.CircularImageView
        android:id="@+id/imgFood"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        app:civ_border_color="#ffffff"
        app:civ_border_width="2dp"
        app:civ_shadow="true"
        app:civ_shadow_color="#000000"
        app:civ_shadow_radius="10" />

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/imgFood">

    <TextView
        android:id="@+id/txtName"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Name"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="16sp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/currentid"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_below="@+id/txtName"
        android:text="Current ID : "
        android:visibility="visible"
        />

    <TextView
        android:id="@+id/studentid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ID"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="16sp"
        android:layout_below="@+id/txtName"
        android:layout_toRightOf="@+id/currentid"
        android:layout_marginEnd="30dp"
        android:layout_marginRight="30dp"
        />

    </RelativeLayout>

    <Button
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_gravity="end"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:id="@+id/editit"
        android:background="@android:drawable/btn_dialog"/>


</RelativeLayout>

вот как выглядит вышеприведенный макет:

а вот и мой адаптерgetview откуда я пытаюсь выполнить намерение / действия;

@Override
public View getView(int position, View view, ViewGroup viewGroup) {

    View row = view;
    ViewHolder holder = new ViewHolder();


    if (row == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(layout, null);

        holder.txtName = (TextView) row.findViewById(R.id.txtName);
        holder.txtPrice = (TextView) row.findViewById(R.id.studentid);
        holder.imageView = (CircularImageView) row.findViewById(R.id.imgFood);
        holder.dit = (Button) row.findViewById(R.id.editit);

        final ViewHolder finalHolder = holder;
        holder.dit.setOnClickListener(new View.OnClickListener() {

            String getname = finalHolder.txtName.getText().toString();
            String gethandicap = finalHolder.txtPrice.getText().toString();

            @Override
            public void onClick(View v) {
                // Do something
                Intent editintent = new Intent(context, MainActivity.class);
                editintent.putExtra("studentname", getname);
                editintent.putExtra("studentid", getID);
                context.startActivity(editintent);
            }
        });

        row.setTag(holder);
    } else {
        holder = (ViewHolder) row.getTag();
    }

    Sudentdb student = studentsList.get(position);

    holder.txtName.setText(student.getName());
    holder.txtPrice.setText(student.getID());


    if (student.getImage() != null && student.getImage().length > 0) {
        Glide.with(context)
                .load(student.getImage())
                .into(holder.imageView);
    } else {
        holder.imageView.setImageBitmap(null);
    }

    return row;

}

У меня проблема в том, что кнопка внутри элемента gridview не выполняет никаких действий, в журнале она только говоритACTION_DOWN и так как я добавил кнопку внутри элемента, элемент также не работает.

РЕДАКТИРОВАТЬ; ДОБАВЛЕНИЕ GRIDVIEW ONCLICK И ПЛАНИРОВАНИЕ

gridView = (GridView) findViewById(R.id.gridView);
    list = new ArrayList<>();
    adapter = new StudentListAdapter(this, R.layout.food_items, list);
    gridView.setAdapter(adapter);

    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                                int position, long id) {

            String dataFromGrid;
            dataFromGrid = ((TextView)(view.findViewById(R.id.txtName))).getText().toString();


            Intent i = new Intent(getApplicationContext(), Student.class);

            i.putExtra("unfromstudent",dataFromGrid);
            startActivity(i);

макет gridview (я пробовал фокусируемый и кликабельный)

&,lt;?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="true"
     >

    <GridView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:focusable="true"
        android:id="@+id/gridView"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:columnWidth="120dp"
        android:gravity="center"
        android:layout_margin="2dp"
        android:numColumns="1"

        />

</RelativeLayout>

Ответы на вопрос(2)

Ваш ответ на вопрос