imageview - setPivotY() behave strange on Android -
I have an imageview, which I want to extend after launching the app
First of all, I did this:
Creating Protected Zero (Bundle Saved Instantestate) {super.onCreate (savedInstanceState); SetContentView (R.layout.activity_main); Find the layout layout = (relative layout) VVBIID (RID Main layout); ImageView imageView = New ImageView (this); imageView.setImageResource (R.drawable.screenshot198); Relational layout. Layout Parameters = New Relative Layout LayoutParam (layout paragraph WRAP_CONTENT, layout para. WRAP_CONTENT); imageView.setLayoutParams (parameter); layout.addView (imageView); imageView.setPivotX (1.0f); imageView.setScaleX (1.5f); imageView.setScaleY (1.5f); } This works great!
Then I set it Try adjusting the code below:
Crate on protected void (bundle savedinstenstate) {super.onCreate (SavedInstanceState); SetContentView (R.layout.activity_main); Find the layout layout = (relative layout) VVBIID (RID Main layout); ImageView imageView = New ImageView (this); imageView.setImageResource (R.drawable.screenshot198); Relational layout. Layout Parameters = New Relative Layout LayoutParam (layout paragraph WRAP_CONTENT, layout para. WRAP_CONTENT); params.addRule (RelativeLayout.ALIGN_PARENT_BOTTOM); imageView.setLayoutParams (parameter); layout.addView (imageView); ImageView.setPivotX (1.0f); imageView.setPivotY (1.0f); ImageView.setScaleX (1.5f); imageView.setScaleY (1.5f); } Hey! What is happening with my tree !?
between the two The paragraph of the only difference code is that, I added [params.addRule (relative.layout.ALIGN_PARENT_BOTTOM)]] to insert an image on the bottom, and added [setPivotY (1.0f)]] so that the image is below Should move towards.
But it seems that [set Pivoti (1.0 F);] does not work properly. Am I missing anything? Thanks!
Comment @ Drops surprisingly helped me setPivotY (view.getHeight ()) Changes in My case has been fixed. When using setPivotY (view.getBottom ()) I was getting an unexpected offset / margin when setScaleY () .
Comments
Post a Comment