Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable touch event programmatically in viewgroup
    primarykey
    data
    text
    <p>I have an application in which i set some images at fix angles.At angle between 270 to 90 angle ,i hide the images by using invisible.but still its touch event working.obviously because images are there.i want to programmatically disable the touch event at these angles.can anybody guide me how to implement this.</p> <p>this is my code in onLayout-</p> <pre><code>float angleDelay = 360 / getChildCount(); if (!childRotate) { for (Integer i = 0; i &lt; childCount; i++) { final Left_Unit textName = (Left_Unit) getChildAt(i); if (textName.getVisibility() == GONE) { continue; } if (angle &gt; 360) { angle -= 360; } else { if (angle &lt; 0) { angle += 360; } } textName.setAngle(angle); textName.setPosition(i); if (position == name.size()) { position = 0; } if (position &lt; childCount) { // textName.setVisibility(View.VISIBLE); textName.setTextname(name.get(position)); textName.setText(name.get(position)); position++; } if (angle &lt;= 270 &amp;&amp; angle &gt;= 90) { textName.setVisibility(View.VISIBLE); } </code></pre> <p>it works fine.</p> <p>for rotation,i called this method</p> <pre><code> for (Integer i = 0; i &lt; childCount; i++) { if (angle &gt; 360) { angle -= 360; } else { if (angle &lt; 0) { angle += 360; } } final Left_Unit child = (Left_Unit) getChildAt(i); if (child.getVisibility() == GONE) { continue; } if (position == name.size()) { position = 0; } if (angle &gt; 85 &amp;&amp; angle &lt; 90) { // child.setVisibility(View.VISIBLE); child.setTextname(name.get(position)); child.setText(name.get(position)); position++; } if (angle &lt;= 270 &amp;&amp; angle &gt;= 90) { child.setVisibility(View.VISIBLE); } else { child.setVisibility(View.GONE);//when i use View.INVISIBLE it works fine &amp; images become visible after rotation but with gone it's not visible again } </code></pre> <p>and this is my xml</p> <pre><code> &lt;com.example.converter.view.Left_Unit android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="a1" android:textColor="#ffffff" android:visibility="invisible" left:textname="text1" /&gt; </code></pre>
    singulars
    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.
    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