Why method AbsoluteLayout gets overlined?
I want to set XY position of imageView but method AbsoluteLayout gets overlined like in code below:
final ImageView animal = (ImageView)findViewById(R.id.imageView1);
animal.setLayoutParams(new <span style="text-AbsoluteLayout.LayoutParams(animal.getWidth(),animal.getHeight(), x1,y1));
h开发者_如何转开发ttp://i.imgur.com/1QBAL.png
AbsoluteLayout
is deprecated, it's not recommended to use it, cause your layout will look different on different devices. Use LinearLayout
or RelativeLayout
instead.
As Egor has mentioned it is already deprecated.
And yes, Whenever you see this kind of overline on any class name or method name or any, it means that it is deprecated class or method or any.
Using an absolute layout is not recommended as others have said (frame layout or relative layout may be better), but if you absolutely must use it, you can use the following bit of code to keep it from tossing warnings right above the offending code:
@SuppressWarnings("deprecation")
Hope this helps!
I changed AbsoluteLayout to Relative and now I can use TranslateAnimation(FromX, ToX, FromY,ToY). Thanke you guys very much! :)
精彩评论