2016-07-11 8 views
-4

Javaクラスからxml値を変更したいと思います。android studioのjavaクラスからxml値を変更する

が、これは私のXMLコードであると私は

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"> 
<rotate 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="0" 
    android:toDegrees="360" 
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:duration="5000" > 
</rotate> 
</set> 

は、どのように私はJavaのクラス

答えて

0

この機能を使用から "toDegrees" の値を変更することができ、Javaクラスから "toDegrees" の値を設定したい

RotateAnimation(float fromDegrees、float toDegrees、int pivotXType、float pivotXValue、int pivotYType、float pivotYValue);

たとえば、次のように実装できます。

RotateAnimation anim = new RotateAnimation(0.0f, 360.0f , Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); 
関連する問題