Summary and analysis of android app upgrade UI

Source: Internet
Author: User

Summary and analysis of android app upgrade UI

This month's busy work is coming to an end, mainly because the company's apps are restructuring projects and UI upgrades. So I will make a summary.

1. Insufficient compilation memory

 

 Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE[2016-03-02 17:00:11 - EGStarSplash] Please check logcat output for more details.[2016-03-02 17:00:11 - EGStarSplash] Launch failed on device: 0123456789ABCDEF
Solution: some applications in the real machine, including your apps, must be removed.

 

2. How does Android manually set the marginleft of the control in Java code?

A. Define LayoutParams

 

LinearLayout. LayoutParams layoutParams = new LinearLayout. LayoutParams (ViewGroup. LayoutParams. WRAP_CONTENT, ViewGroup. LayoutParams. WRAP_CONTENT); // defines a LayoutParams
B. Set marginLeft in LayoutParams.

 

LayoutParams. setMargins (20, 0,); // The four parameters are in the order of top left and bottom right

C. Set the LayoutParams to the control.

MView. setLayoutParams (layoutParams); // mView is a control

Here we will talk about the parameters new LinearLayout. LayoutParams (ViewGroup. LayoutParams. WRAP_CONTENT, ViewGroup. LayoutParams. WRAP_CONTENT)

If the parent layout is relative, It is RelativeLayout. LayoutParams layoutParams = new RelativeLayout. LayoutParams (parameters. LayoutParams. WRAP_CONTENT, parameters. LayoutParams. WRAP_CONTENT); // defines a LayoutParams.

Last, I would like to add:

FILL_PARENT, that is, fill (the same size as the parent container );
WRAP_CONTENT: Wrap the component.

LayoutParams. setMargins (20, 0,); the unit is pixel.

To use the resolution of different machines, you need to convert the dip into px.

 

mLayoutParams.setMargins(0, 0, 10, dip2px(this,54)); private static int dip2px(Context context, float dpValue) {          final float scale = context.getResources().getDisplayMetrics().density;          return (int) (dpValue * scale + 0.5f);      } 

 

 

3. layout of Separators

Use android: divider = "@ drawable/shape_divider2"
Android: showDividers = "beginning | end"

Set the split line interval. Sometimes the end line cannot be displayed because you set the height of the Child layout match_parent,

The parent layout is 50dp, which means it does not work out. In this case, you should set the sub-layout 49dp, for example, if your android: divider = "@ drawable/shape_divider2" is 1dp.

 

4. global variable inheritance for base-class activities

Android Write activity generally has a first basic activity. All the activities in the project inherit this foundation.

If global variables such as protected boolean mItemCanLongClick = true are defined;

In the subclass, initialize and change this value. It must be in the front.

// Whether the Item supports long press

Super. mItemCanLongClick = false;
Super. onCreate (savedInstanceState );

 

5. Hide the scroll bar, including listview

The Android Listview hides the scroll bar in Label.
Android: fastScrollEnabled = "false"

The following attributes can be set to none or none. The effect may be a little different. Determines whether to set it to none based on the actual situation.
Android: scrollbars = "none"

 

6. Set the background border color, amplitude, and background color in xml format.

 

      
       
       
   
  

7. Set the button or layout click effect in xml

 

 

      
       
       
   
  

8. Underline TextView in android

 

 

TvTest. getPaint (). setFlags (Paint. UNDERLINE_TEXT_FLAG); // underline tvTest. getPaint (). setAntiAlias (true); // anti-aliasing

To upgrade the UI, you must find common interfaces, or many of them have similar interfaces. After unified reconstruction, inheritance can be reused continuously to facilitate the addition and maintenance of new functions. You must confirm the upgrade solution with the UI Designer again and again. Otherwise, it will be you again. Haha...

 

 

 

Related Article

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.