Rotate ImageView source from layout xml file

前端 未结 3 2074
南笙
南笙 2021-02-06 20:53

I have this ImageView in my layout:



        
3条回答
  •  北海茫月
    2021-02-06 21:30

    Add "id" at ImageView (if not generate auto):

     android:id="@+id/imageView"
    

    and use the "id" (kotlin example):

    val imageView = findViewById(R.id.imageView)
    imageView.setRotation(90f) // rotate 90 degree
    

提交回复
热议问题