Animation on a view doesn't 'stick' in reality

by fg1921 » Fri, 10 Apr 2009 07:38:05 GMT


Sponsored Links
 Hi

I'm using a TranslateAnimation to slide a ViewGroup in and out of
screen. However after the animation slides the view out, the
transparent view is still 'clickable' in the same place. I used
setFillAfter to TRUE thinking that the animation would 'stick' but I
can't seem to get the view out of my 'face'.

Any way to do this without setting up an animation completion handler
and then hide the view explicitly?
--~--~---------~--~----~------------~-------~--~----~



Animation on a view doesn't 'stick' in reality

by fg1921 » Fri, 10 Apr 2009 08:21:16 GMT


 >

Thanks Romain - I did this (and the completion listener) neither of
these work. Basically the 'AbsoluteLayout' ViewGroup slides out of the
screen but then when you tap on the are where that view once was, the
old buttons apparently still get tapped (eventhough completely
invisible). If I've 'translated' a view, shouldn't it stay where it is
and not get the kind of focus/clicks it's getting right now? I tried
setEnabled(false), setVisibility(View.GONE) -- nothing seems to work.
The 'invisible' view still gets touch events and buttons are being
pressed from the view that got slid away.

Am I doing something wrong?
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Animation on a view doesn't 'stick' in reality

by fg1921 » Fri, 10 Apr 2009 08:33:39 GMT


 Okay I've figured it out. I would personally consider this a bug but
not sure if this is how it's meant to be.

Basically in onAnimationEnd I had to loop over all children inside the
viewgroup (and children of children) and set their visibility to GONE/
INVISIBLE and the buttons stopped getting touch events after animation
ended. And then onAnimationStart I had to set their visibility back to
VISIBLE.

Shouldn't setting visibility/focusability/enabled state etc on the
parent ViewGroup apply these down to its children as well (especially
the visibility part). Since the parent view became invisible, which is
fine, but the children view didn't (well internally) and thus were
intercepting Touch events eventhough the view as a whole was not
visible.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. What's wrong with this code - SimpleAdapter

Hi, I can't seems to display multiple roll in listview. What is wrong
with my code?
It just display line 1 - fruit1 and fruit2-4 doesn't appear.

---
ArrayList<HashMap<String,String>> list =
new ArrayList<HashMap<String,String>>();

HashMap<String,String> map = new HashMap<String,String>();
map.put("fruit1","Apple");
map.put("fruit2", "Orange");
map.put("fruit3", "Pear");
map.put("fruit4", "Banana");
list.add(map);

SimpleAdapter adapter = new SimpleAdapter(this, list,
R.layout.fruit_list,
new String[] {"fruit1","fruit2","fruit3","fruit4"},
new int[] {R.id.fruit1,R.id.fruit2, R.id.fruit3, R.id.fruit4}
);
ListView lv=(ListView)findViewById(R.id.fruitView);
lv.setAdapter(adapter);

---
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<Spinner android:id="@+id/sort_by" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:entries="@array/
default_sorts">
</Spinner>

<ListView
android:id="@+id/fruitView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>

---

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector"
android:padding="10sp">
<TextView
android:id="@+id/fruit1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
<TextView
android:id="@+id/fruit2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
<TextView
android:id="@+id/fruit3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
<TextView
android:id="@+id/fruit4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
</LinearLayout>

-- 

2. ACTION_AIRPLANE_MODE_CHANGED

Hi,

I have a question about airplane mode broadcast intent.

The documentation says that the "state" extra value is a boolean.

http://developer.android.com/reference/android/content/Intent.html#ACTION_AIRPLANE_MODE_CHANGED

In the source of android apps, the PhoneApp reads it as integer:

if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
   boolean enabled = System.getInt(getContentResolver(),
System.AIRPLANE_MODE_ON, 0) == 0;
   ...
}

In some device (custom rom) there is an error if they try to read a
boolean:

02-01 16:46:57.088: WARN/Bundle(302): java.lang.ClassCastException:
java.lang.Integer
02-01 16:46:57.088: WARN/Bundle(302):     at
android.os.Bundle.getBoolean(Bundle.java:786)
02-01 16:46:57.088: WARN/Bundle(302):     at
android.content.Intent.getBooleanExtra(Intent.java:3259)
02-01 16:46:57.088: WARN/Bundle(302):     at com.android.phone.PhoneApp
$PhoneAppBroadcastReceiver.onReceive(PhoneApp.java:1677)

Can you help me to understand it?

It should be an integer or a boolean? Where is the mistake?

Thanks, Tams

-- 

3. android plugin for eclipse slow performance

4. Render a PDF in a View

5. Motorola xoom 7.2jt

6. [isat-android] WTA : Masalah pada Angry Birds

7. Video Teaser Samsung Galaxy S2