Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android in the coordinate system and a method to obtain the coordinates     - error 1819 (HY000): your password does not satisfy the current policy requirements (Database)

- Some problems and countermeasures Linux system calls exist (Linux)

- To install and deploy PHP environment under the CentOS (Server)

- Qt shared memory interprocess communication (Programming)

- Variables Python variables (Programming)

- Android studio multi-channel ultra-compact version of the package (Programming)

- Linux Getting Started tutorial: Experience KVM Virtual Machine chapter (Linux)

- Oracle Sql Loader tool has shown signs (Database)

- CentOS 6.5 platform offline compile and install PHP5.6.6 (Server)

- The difference between IPython and Python (Linux)

- Eight sorting algorithm implemented in Python (Programming)

- Plasma 5.4 How to install on Kubuntu 15.04 (Linux)

- Linux modify the network interface name (Linux)

- To install PXE + Kickstart under CentOS 6.x operating system (Linux)

- Installation and use of Linux Sniffer tool Tcpdump (Linux)

- Ubuntu install driver manager Mint Driver Manager and Device Driver Manager (Linux)

- Oracle Standby Redo Log experiment (Database)

- MySQL replication master and slave structure built (Database)

- Linux System Getting Started Tutorial: permission to permanently modify the USB device in Linux (Linux)

- CentOS 6.6 running level (Linux)

 
         
  Android in the coordinate system and a method to obtain the coordinates
     
  Add Date : 2016-05-02      
         
       
         
  Ndroid There are two coordinate systems, respectively called Android coordinate system and the view coordinate system. The correspondence also some related methods can get coordinates coordinate system. Only clear these differences, in order not to error, or you can not get the desired effect at the time of implementation.

A, Android coordinate system and the view coordinate system

    (1) Android coordinates

      Let's take a look at Android coordinate system is what it looks like.

Android mobile phone screen coordinates of the top left vertex coordinate origin, from that point to the right of the x-axis positive direction, from that point down the y-axis positive direction. The touch event, use getRawX () and getRawY () method

Get the coordinates of this coordinate system is to coordinate values ​​under the standard.

    (2) the view coordinate system

    android in another coordinate system called the view coordinate system, which describes the child views in the parent view location.

View coordinate system is the upper left corner of the parent view for the origin of coordinates. Corresponding to the origin of the right x axis positive direction, the positive y-axis origin for the downward direction. In touch by

Coordinate getX () and getY () to get the value is the coordinate values ​​for the view coordinate system.


Second, the method of obtaining those coordinates as well as the relative distance

      In the android, there is provided a very rich way to get coordinates and relative distance. However, when using these methods, which must be clear is to obtain the coordinates of the standard.

In order to clear them out of these methods


Description of each method for obtaining a coordinate value or distance is from where to where. Explain the figure there are three black frame, the outermost layer of the cell phone screen,

The intermediate layer is ViewGroup, the innermost is ViewGroup placed in view.

Methods annotated method can be divided into two categories, one is the View provided a method MotionEvent class is provided. Respectively, as follows:

Coordinate View provides access to and from the approach:

getTop () Gets the distance to the top edge of its parent layout view to its top edge

getLeft () to get a view of their own from the left to the left of its parent's layout

getRight () to get a view of their own to the right distance to the left of its parent's layout

getBottom () to get to the bottom of the view itself from the top edge of its parent's layout


MotionEvent method provided:

getX () Gets the distance from the controls on the left click event, that view coordinates

getY () Gets the distance from the event click on the top edge of the control that the view coordinates

getRawX () to get the click event is the distance from the entire screen to the left, that absolute coordinates

getRawY () to get the click event from the entire screen from the top edge of absolute coordinates
     
         
       
         
  More:      
 
- Teamviewer not start in Linux (Linux)
- The method of Linux into the rescue mode (Linux)
- Change all child files and subdirectories in the owner permissions Ubuntu (Linux)
- After the first remote installation GlassFish Web to remotely access their back office management system error solution appears (Server)
- Linux Crontab Timing task command Detailed (Linux)
- C language programming entry - Common operators (Programming)
- Oracle11g build physical standby database (Database)
- Use cmake to compile and install MySQL 5.5 (Database)
- Oracle 11g Export guide problem not an empty table (Database)
- Erase do with HTML5 Canvas and diffusion effect (Programming)
- Use Tails 1.4 Linux system to protect the privacy and anonymity (Linux)
- 20 open source / commercial Linux server management control panel (Server)
- Several reasons MySQL garbled (Database)
- Job achieve automation in Ubuntu 14.04 - Using Cron (Linux)
- Linux Command-line MySQL summary (Database)
- Java uses JDBC connect database (Programming)
- Customize the 404 error page Nginx (Server)
- MongoDB version 3.2 WiredTiger storage engine performance tests (Database)
- Linux dual physical network card set to a virtual NIC (Linux)
- Binary Packages Golang (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.