Android has been working on Android for 6 years to obtain the location and coordinates of the sub View
public View(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
}
```
View constructor in source code
Through the comments of the source code, we can see that:
If the view is new in Java code, call the first constructor – > View (context); If the view is declared in xml, the second constructo ...
Posted by socio on Thu, 16 Dec 2021 22:00:02 +0100
Detailed explanation of Android external storage and internal storage, from entry to mastery
The complete code is as follows:
public class ExternalActivity extends AppCompatActivity {
private EditText infoEdt;
private TextView txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_external);
infoEdt = ...
Posted by hammerloaf on Thu, 16 Dec 2021 21:42:49 +0100
Android custom View minimum necessary knowledge, advanced Android Development Technology
The custom View includes three parts:
LayoutDrawingTouch feedback (Event Handling)
Layout stage: determine the position and size of the View. Drawing stage: draw the contents of the View. Touch feedback: determine where the user clicked.
The layout stage includes two processes: Measurement and layout. In addition, the layout stage supports t ...
Posted by Jaguar83 on Thu, 16 Dec 2021 20:45:58 +0100
Design pattern factory pattern (including simple factory pattern, factory method pattern and abstract factory pattern)
Related links:
[design mode] column: [design mode] column
Relevant example codes can be downloaded: Examples of common Java design patterns
brief introduction
At present, there are three factory modes, namely:
Simple factory mode Factory method model Abstract factory pattern
Simple factory mode
Simple Factory Pattern is a creation ...
Posted by scotchegg78 on Thu, 16 Dec 2021 15:52:02 +0100
[design mode] 23 design modes - single case mode
Article benefits: Alibaba coding specification - download of each version
In programming, we often only need a global instance. For example, the task manager, database connection pool, thread pool, etc. in Windows use the singleton mode.
There are many ways to implement Singleton.
To implement a singleton, consider the following:
1. Who cr ...
Posted by R4nk3d on Thu, 16 Dec 2021 10:25:06 +0100
30 seconds to start the new generation of Http request artifact RxHttp, IDEA is too strong
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies { implementation 'com.github.liujingxing.rxhttp:rxhttp:2.6.0' implementation ‘com.squareup.okhttp3:okhttp:4.9.0’ //rxhttp v2. Since version 2.2, you need to manually rely on okhttp kapt ‘com.github.liujingxing.r ...
Posted by mbbout on Thu, 16 Dec 2021 07:10:31 +0100
Simple implementation of SpringMvc handwriting - AOP aspect programming
For those who have read the previous article, please move on to the previous article. This article is suitable for people who have used AOP aspect programming.
What is Aop
AOP (Aspect Oriented Programming) is short for Aspect Oriented Programming.
AOP is implemented by precompiling and runtime dynamic agent. The programming idea of dynamical ...
Posted by Unforgiven on Wed, 15 Dec 2021 21:10:31 +0100
[Spring] proxy mode -- dynamic proxy
Agent mode -- dynamic agent
Static proxy: the proxy class must exist, Dynamic agent: when the program is running, the agent class is dynamically generated according to the object to be represented. Type: 1. Dynamic agent based on JDK 2. Dynamic agent based on CGLIB
1 dynamic agent based on JDK
Static, directly using Proxy call newProxyInsta ...
Posted by ojsimon on Wed, 15 Dec 2021 18:22:58 +0100
Source code analysis of Android event distribution, as an Android Developer
Activity
There are two main methods related to event delivery in an Activity, dispatchTouchEvent() and onTouchEvent(). Event delivery starts with the dispatchTouchEvent() method of the Activity.
Event distribution
Event distribution method in Activity: dispatchtouchevent (), and its source code is as follows:
//Event distribution
publi ...
Posted by Bisdale on Wed, 15 Dec 2021 14:20:35 +0100
Android component-based actual combat, ant gold clothes push on all sides
(1) Distinguish between application and library
if (isApplicationModule1.toBoolean()){
apply plugin: 'com.android.application'
}else{
apply plugin: 'com.android.library'
}
(2) Add applicationId
defaultConfig {
if (isApplicationModule1.toBoolean()){
applicationId "com.demo.myapplication.module1"
...
Posted by -Mike- on Wed, 15 Dec 2021 10:45:20 +0100