除按钮文本外的Android按钮动画

除按钮文本外的Android按钮动画,android,android-layout,animation,Android,Android Layout,Animation,我的android应用程序中有一个动画按钮。动画开始时,按钮文本也会设置动画。但我不需要那种动画。有没有只保留按钮背景动画的解决方案 对不起,我的英语很差 以下是动画文件夹中的动画XML: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_

我的android应用程序中有一个动画按钮。动画开始时,按钮文本也会设置动画。但我不需要那种动画。有没有只保留按钮背景动画的解决方案

对不起,我的英语很差

以下是动画文件夹中的动画XML:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<rotate
   android:fromDegrees="0"
   android:toDegrees="360"
   android:pivotX="50%"
   android:pivotY="50%"
   android:duration="500"
   android:startOffset="0"
   android:repeatCount="infinite"
   android:repeatMode="restart" />
</set>

请帮助我。

最简单的解决方案如下 删除按钮文本 添加文本视图 把它放在按钮上
按钮动画不会影响文本视图,两者将分别处理,您的文本动画问题将得到解决

按钮文本是按钮的一部分。因此,不能单独设置按钮文本和按钮背景的动画。但您可以通过使用TextView和按钮来实现这一点。文本视图上的叠加按钮和动画按钮…@GopalRao,非常感谢兄弟。非常感谢兄弟。永远欢迎兄弟
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/firstscreenimage" />

</RelativeLayout>

<Button
    android:id="@+id/button1"
    android:layout_width="150dp"
    android:layout_height="150dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="35dp"
    android:background="@drawable/animation0"
    android:text="Start" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/relativeLayout1"
    android:layout_marginRight="28dp"
    android:layout_marginTop="26dp"
    android:text="0.0km"
    android:textSize="30dp" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true" >

    <requestFocus />
</EditText>

</RelativeLayout>
 public class Gps extends Activity {

TextView display;
Button start;
boolean doubleclick = false;
AnimationDrawable AppNameAnimation;

double currentLon = 0;
double currentLat = 0;
double lastLon = 0;
double lastLat = 0;
double distance;

LocationManager lm;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    display = (TextView) findViewById(R.id.textView1);
    start = (Button) findViewById(R.id.button1);
    final Animation animRotate = AnimationUtils.loadAnimation(this,
            R.anim.anim_rotate);

    start.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (!doubleclick) {
                v.startAnimation(animRotate);
                start.setText("stop");
                lm = (LocationManager) getSystemService(LOCATION_SERVICE);
                lm.requestLocationUpdates(lm.GPS_PROVIDER, 0, 0, Loclist);
                Location loc = lm.getLastKnownLocation(lm.GPS_PROVIDER);

                if (loc == null) {
                    display.setText("No GPS location found");
                } else {
                    // set Current latitude and longitude
                    currentLon = loc.getLongitude();
                    currentLat = loc.getLatitude();

                }
                // Set the last latitude and longitude
                lastLat = currentLat;
                lastLon = currentLon;
                doubleclick = true;
            } else {
                lm.removeUpdates(Loclist);
                start.setText("start");
                v.clearAnimation();
                doubleclick = false;
                Intent in = new Intent(Gps.this, NextActivity.class);
                startActivity(in);
            }

        }
    });
}