Android:围绕中心旋转图像?

时间:2015-07-27 09:55:45

标签: java android animation rotation

我希望图像围绕其中心旋转,但我的方法不起作用,它显然围绕不同的枢轴点旋转。我是Android开发的新手,所以你可能会在我的代码中发现一些严重的错误。此外,如果我旋转屏幕,图像将旋转回其初始旋转。 这是我的文件:

fragment_main.xml

DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(String));      
dt.Columns.Add("Class", typeof(String));
dt.Columns.Add("RollNo", typeof(String));
foreach (DataGridViewRow dgr in dgv_Student.Rows)
{
  dt.Rows.Add(dgr.Cells["Name"].Value, dgr.Cells["Class"].Value, dgr.Cells["RollNo"].Value);
 }
        ds.Tables.Add(dt); 
        CrystalReport1 cr = new CrystalReport1 ();          
        cr.SetDataSource(ds);

MainActivityFragment.java

dtInvalidCustomers = SessionManager.GetSessionValue<DataTable>(
        Constants.IMPORT_DATATABLE_INVALIDS);

1 个答案:

答案 0 :(得分:3)

试试这个:

 Animation a = new RotateAnimation(0.0f, 90.0f,
                    Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                    0.5f);