Note that there are some explanatory texts on larger screens.

plurals
  1. POGridView and ImageButton Weird issue
    text
    copied!<p>Hi all I have custom grid view with imageButton and textView as follows</p> <p><img src="https://i.stack.imgur.com/U98Zi.png" alt="enter image description here"></p> <p>Here i have used imageButton.. The problem is the grid is not clickable.. But if i use here imageView it works fine but UI is not appropriate.</p> <p>Here is my layout</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:gravity="center" android:padding="5dp" &gt; &lt;ImageButton android:id="@+id/profilePic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/newlocation" android:background="@drawable/btnbackground" /&gt; &lt;TextView android:id="@+id/SpeakerName" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:textSize="15sp" android:text="Some Speaker" /&gt; </code></pre> <p></p> <p>Here is my adapter</p> <pre><code> package com.tt.cc; import java.util.List; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class SavedConferencesGridAdapter extends ArrayAdapter&lt;String&gt;{ Context mContext; List&lt;String&gt; confernceList; public SavedConferencesGridAdapter(Context context, int textViewResourceId, List&lt;String&gt; confernceList) { super(context,textViewResourceId,confernceList); this.confernceList = confernceList; this.mContext = context; Log.e("TAG", confernceList.size()+""); } int[] picIds = new int[] { R.drawable.newschedule,R.drawable.newexhibitors, R.drawable.newsponsers, R.drawable.newlocation, R.drawable.newfavourites, R.drawable.newreminder,R.drawable.info,R.drawable.info,R.drawable.info,R.drawable.info,R.drawable.info,R.drawable.info }; @Override public int getCount() { // TODO Auto-generated method stub return confernceList.size(); } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View v; if(convertView==null){ LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = li.inflate(R.layout.entity, null); TextView tv = (TextView)v.findViewById(R.id.SpeakerName); tv.setText("tt"); /*ImageView iv = (ImageView) v.findViewById(R.id.profilePic); iv.setImageResource(picIds[position]);*/ } else { v = convertView; } return v; } } </code></pre> <p>and here is my activity</p> <pre><code> public class SavedConferencesActivity extends Activity{ GridView confereneceGridView; ArrayAdapter&lt;String&gt; conferneceAdapter; Button btnUpdate; List&lt;String&gt; conferenceList; TextView txtHeading; Boolean result = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } protected void onStart() { super.onStart(); setContentView(R.layout.homegridlayout); initialize(); confereneceGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(SavedConferencesActivity.this, conferenceList.get(position)+"", Toast.LENGTH_SHORT).show(); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); conferneceAdapter = new SavedConferencesGridAdapter(this, android.R.layout.simple_list_item_1, conferenceList); confereneceGridView.setAdapter(conferneceAdapter); } private void initialize() { confereneceGridView = (GridView) findViewById(R.id.gridOfConference); btnUpdate = (Button) findViewById(R.id.btnUpdate); txtHeading = (TextView) findViewById(R.id.txtTag); conferenceList = new ArrayList&lt;String&gt;(); conferenceList.add("AA"); conferenceList.add("BB"); conferenceList.add("CC"); if (conferenceList.size() == 0) txtHeading.setText("No conferences saved"); else txtHeading.setText("Selected Conferences"); } } </code></pre> <p>Please help me in solving this problem. Or if any alternative available..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload