Q:

onClick(View v) not recognised

This fragment being used to understand how fragments work.  However, the error message "The type ImageFragment must implement the inherited abstract method View. OnClickListener.onClick(View). 
Why is the method onClick not seen?  And how can it be rectified? 
package com.example.fragmenttest170511;

import android.support.v4.app. Fragment;
import android.os. Bundle;
import android.view. LayoutInflater;
import android.view. View;
import android.view. ViewGroup;
import android.widget. Button;
import android.widget. LinearLayout; 
import android.view. View. OnClickListener;

public class ImageFragment extends Fragment implements View. OnClickListener{

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle       savedInstanceState)
    {
        final LinearLayout layout = new LinearLayout(getActivity());
        layout.setOrientation(LinearLayout. HORIZONTAL);
        Button btnGreen = new Button(getActivity());
        layout.addView(btnGreen);
        btnGreen.setOnClickListener(new OnClickListener() {
    @Override
        public void onClick(View v) {}

    });

        return layout;
    }   
}

A:

It is because your onClick() method is not actually in your ImageFragment class but in the anonymous inner class defined for your Button's OnClickListener. 
Move the method outside the Listener assignment and put it in your ImageFragment class like so:
public class ImageFragment extends Fragment implements View. OnClickListener{

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle       savedInstanceState)
    {
        final LinearLayout layout = new LinearLayout(getActivity());
        layout.setOrientation(LinearLayout. HORIZONTAL);
        Button btnGreen = new Button(getActivity());
        layout.addView(btnGreen);
        btnGreen.setOnClickListener(this);
        return layout;
    }   

    @Override
    public void onClick(View v) {
        // handle clicks here
    }
}

Alternatively remove the implements View. OnClickListener from the class declaration and use your current implementation of the anonymous inner class.   
Personally, I always implement OnClickListener instead of anonymous inner classes.  They always feel messy to me.  That or if it's a particularly complicated view I have on occasion defined a different, new class in a new file to solely handle all clicks for that Activity/Fragment.