Why doesn't textView become invisible?
Here is my xml layout:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/tvRotate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rotate Me" /> </LinearLayout>
.. and here is my activity:
public class RotateMeActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tvRotate = (TextView) findViewById(R.id.tvRotate); RotateAnimation r = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); r.setDuration(0); r.setFillAfter(true); tvRotate.startAnimation(r); tvRotate.setVisibility(View.INVISIBLE); } }
My goal is to rotate the view and then hide and show it in code by setting setVisibility. The following steps, but setRotation are only available in API Level 11. I need a way to do this at API level 10.
tvRotate.setRotation(180);//instead of the RotateAnimation, only works in API Level 11 tvRotate.setVisibility(View.INVISIBLE);
android visibility rotation animation rotateanimation
ZippyFerguson Dec 31 '11 at 19:12 2011-12-31 19:12
source share