[Android] The simplest mirroring system view control

Source: Internet
Author: User
Cause: Android comes with a control that doesn't have a mirroring feature, but we can do it ourselves. In fact, it is very simple to rewrite the draw method of the system control, not the OnDraw method. Specific can see the source solution: This is the image I wrote Seekbar, the company needs
Package Com.finals.oilrank.util.view;import Android.content.context;import Android.graphics.canvas;import Android.util.attributeset;import Android.widget.seekbar;public class Myseekbar extends SeekBar {public Myseekbar ( Context context, AttributeSet Attrs) {Super (context, attrs);} @Overridepublic void Draw (canvas canvas) {canvas.save (); Canvas.scale ( -1, 1, getwidth ()/2, GetHeight ()/2); Super.draw ( Canvas); Canvas.restore ();}}



This is very simple. Just still have the problem, is the touch event you have to deal with, of course, here is only the image of the wording, touch the same willing.

[Android] The simplest mirroring system view control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.