Android 7.0 or above (including 8.0), popupWindow pop-up position is abnormal, solution
Generally, in our App, click the position of the title to pop up the menu, and the effect is as follows:
Is that hard? Picking up the keyboard is doing
public void showAsDropDown(View anchor, int xoff, int yoff) {
showAsDropDown(anchor, xoff, yoff, DEFAULT_ANCHORED_GRAVITY);
}
1
2
3
But it's not always what we th ...
Posted by hmb3801 on Tue, 31 Mar 2020 23:43:19 -0700
Research on the order of output key value pairs of JsonObject toString()
There is a set of interface in the background, which needs to sort the parameters, so a set of sorting method is written. Before the interface is requested, all parameters are sorted. Here, JsonObject and its own toString method are used. During the test, it is found that the running of the program on a Android 4.4 s ...
Posted by gmartin1215 on Tue, 31 Mar 2020 23:28:31 -0700
RadioButton icon resizes (TextView also works)
There is no corresponding layout parameter for the icon size of RadioButton. In this paper, the RadioButton is customized by means of custom attribute to control the image size.
Key points of this paper:
Use of custom properties.
Solve the problem of customizing the size of icons on the top, bottom, left and right of RadioButton text.
This m ...
Posted by TimSawyers on Tue, 31 Mar 2020 22:18:46 -0700
Bluetooth adapter can't find Bluetooth device problem when startDiscovery is over Android 6.0 / 7.0 +
Reprinted from: https://blog.csdn.net/zhangphil/article/details/77896924
Bluetooth adapter can't find Bluetooth device problem when startDiscovery is over Android 6.0 +
One of the important reasons for the problem is the permission problem of Android 6.0 +, Android 7.0 +. Good Bluetooth code running on Android 4.0 +, abnormal ...
Posted by literom on Tue, 31 Mar 2020 21:44:29 -0700
Imitated singing bar UI effect
I want to open my voice and sing in the past few days. I found that the interaction effect in the app is very interesting. I suddenly want to write it out (maybe this is instinct)
On the left is the local effect, and on the second is the singing bar effect
Write code here
Picture description here
Picture descriptio ...
Posted by monkeyj on Tue, 31 Mar 2020 21:05:40 -0700
BottomNavigationView bottom navigation bar, add quantity corner mark reminder
First, let's look at the effect picture of the implementation:
The code is also very simple
Each Tab in the BottomNavigationMenuView is a FrameLayout, so we can add views on it at will, so we can also implement our corner sign.
//Get the entire NavigationView
BottomNavigationMenuView menuView = (BottomNavigationMenuV ...
Posted by volomike on Tue, 31 Mar 2020 18:29:17 -0700
Android adds pictures and alarm clocks to the database and displays them with listview 2
Android adds pictures and alarm clocks to the database and displays them with listview 2
Novice on the road, please give me more advice
Continue last time, the teacher proposed to add two more alarm clocks. Although it was not satisfactory, it also made
Because it's not so hard for a novice to simplify his intelligen ...
Posted by BAM1979 on Tue, 31 Mar 2020 14:33:17 -0700
The use of shared preferences in Android data storage
Introduction to SharedPreferences
SharedPreferences is a data storage method of android. xml is stored in memory in the form of key value pairs. Files are stored in the / data / data / / shared ﹤ prefs directory. SharedPreferences Initialization
getSharedPreferences(name,mode)
The parameters name and mode represent ...
Posted by Blesbok on Tue, 31 Mar 2020 10:57:06 -0700
Advanced way of Android: scanning and generating 2D codes
Ten thousand years ago, I wanted to write an article to record the implementation of the QR code function. I didn't expect that it would be now. Today is Saturday~~~
Now there are a lot of tripartite libraries about scanning code on the Internet. Of course, these are all extended based on the framework of zxing. Here I ...
Posted by schris403 on Tue, 31 Mar 2020 08:58:00 -0700
recycleView implements item Click to change the item color, and other item colors change back to
recycleView implements item Click to change the item color, and other item colors change back to
The horizontal scrolling effect is needed in the project. According to the previous ideas, I will write a ScrollView, add a LinearLayout inside, add controls in the code dynamically, and then delete or change colors dynami ...
Posted by I Am Chris on Tue, 31 Mar 2020 08:33:13 -0700