Note that there are some explanatory texts on larger screens.

plurals
  1. POHow To apply click listener?
    primarykey
    data
    text
    <p>I am making an application by using page curl for that am using this link:-</p> <pre><code> https://github.com/harism/android_page_curl. </code></pre> <p>In that link implementing page curl using bitmap.But My requirement is that curl to View ,for that I convert View(LinearLayout) into bitmap and set onclicklistener on child view, for more clarification please see attached image <img src="https://i.stack.imgur.com/JKTzQ.png" alt="page curl work properly unfortunatly onclick listener is not working please anyone suggest me"></p> <p>My code is as:-</p> <pre><code>public static LinearLayout createProgrammeView(final Context context, int width, int height, String title, String time) { // Upper layout of screen LinearLayout objmainlayout = new LinearLayout(context); if (height &gt;= 320) { objmainlayout.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, (height -100))); Log.e("chectttttttttttlayout",""+(height-71)); } else { objmainlayout.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, (height - 90))); } objmainlayout.setBackgroundColor(Color.WHITE); objmainlayout.setOrientation(LinearLayout.VERTICAL); objmainlayout.setPadding(10, 0, 10,0); for (int mindex = 0; mindex &lt;3; mindex++) { RelativeLayout.LayoutParams objparams; // Layout Root View (RelativeLayout) RelativeLayout objrelativeinnerlayout = new RelativeLayout(context); if (height &gt;= 320) { objparams = new RelativeLayout.LayoutParams(width-20, ((height - 71) / 3) - 10); Log.e("chectt33333tlayout",""+(((height - 71) / 3) - 10)); } else { objparams = new RelativeLayout.LayoutParams(width, ((height - 90) / 3) - 10); } //objparams.topMargin=10; objrelativeinnerlayout.setLayoutParams(objparams); // rlv.setBackgroundResource(R.drawable.sss); // rlv.setBackgroundResource(R.drawable.sss); ImageView objrow1img1 = new ImageView(context); if (height &gt;= 320) { objrow1img1.setLayoutParams(new RelativeLayout.LayoutParams( (width - 30) / 2,((height - 71) / 3) - 10)); } objrow1img1.setScaleType(ScaleType.FIT_XY); RelativeLayout.LayoutParams objlp = (RelativeLayout.LayoutParams) objrow1img1.getLayoutParams(); objlp.topMargin=10; objlp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); objrow1img1.setId(1); objrow1img1.setBackgroundColor(Color.RED); if (mindex == 0) { objrow1img1.setImageResource(R.drawable.fblogin); objrow1img1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(context,"onclick",Toast.LENGTH_LONG).show(); Log.e("check click","good"); //Intent objIntent = new Intent(context, //FacebookAlbumList.class); //objcoContext.startActivity(objIntent); } }); } else {/* if (data != null &amp;&amp; data.size() &gt; saveindex &amp;&amp; data.get(saveindex) != null &amp;&amp; data.get(saveindex).get(0) != null &amp;&amp; data.get(saveindex).get(0).getImagepath() != null) { objrow1img1.setVisibility(View.VISIBLE); System.gc(); decodeBitMap(data.get(index).get(0).getImagepath(), objrow1img1); } else { objrow1img1.setVisibility(View.INVISIBLE); } */} objrelativeinnerlayout.addView(objrow1img1); ImageView objrow1img2 = new ImageView(context); objrow1img2.setLayoutParams(new RelativeLayout.LayoutParams( (width - 30) / 2,((height - 71) / 3) - 10)); objrow1img2.setScaleType(ScaleType.FIT_XY); objrow1img2.setBackgroundColor(Color.RED); RelativeLayout.LayoutParams objlrelativelayoutparam = (RelativeLayout.LayoutParams) objrow1img2 .getLayoutParams(); objlrelativelayoutparam.setMargins(10, 10, 0, 0); objlrelativelayoutparam.addRule(RelativeLayout.RIGHT_OF,1); objrelativeinnerlayout.addView(objrow1img2); objmainlayout.addView(objrelativeinnerlayout); } return objmainlayout; } public static Bitmap loadBitmapFromView(LinearLayout v) { v.measure(MeasureSpec.makeMeasureSpec(v.getLayoutParams().width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec( v.getLayoutParams().height, MeasureSpec.EXACTLY)); v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.RGB_565); Canvas c = new Canvas(b); v.draw(c); return b; } </code></pre> <p>Here I put code of Myview and converting it into bitmap.Problem is that How I can get onclickListener on that? Please anyone suggest me thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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