Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of repeated beating of android racing lights and not rolling?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

The main content of this article is to explain how to solve the problem of repeated beating of android racing lights and not scrolling. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of repeated beating of android racing lights and not scrolling.

Reason: View on the page has been redrawn and focus has been preempted.

For example:

1. When the width of TextView is set to wrap_content,setText (), the content change will cause View to redraw.

2. The dynamic generation of View in the page will also affect the effect of racing lanterns.

Solution:

1. Set the width and height of the View of the page to a fixed value as much as possible, and try not to modify it dynamically.

two。 Custom TextView overrides the isFocused () function to let him put back the true, that is, to get it all the time, and the focus effect will naturally come out. If this doesn't solve the problem, it won't be the focus problem.

Public class MarqueTextView extends TextView {public MarqueTextView (Context context, AttributeSet attrs, int defStyle) {super (context, attrs, defStyle);} public MarqueTextView (Context context, AttributeSet attrs) {super (context, attrs);} public MarqueTextView (Context context) {super (context);} @ Override public boolean isFocused () {return true @ Override protected void onFocusChanged (boolean focused, int direction, Rect previouslyFocusedRect) {if (focused) {super.onFocusChanged (focused,direction,previouslyFocusedRect);}} @ Override public void onWindowFocusChanged (boolean focused) {if (focused) {super.onWindowFocusChanged (focused);}

The editor also saw a solution to the repeated jitter of the android racing lantern and shared it with you. Thank the original author for sharing.

First post the implementation code of TextView racing lantern.

There is a problem, in the interface, there is an advertising rotation function realized by viewPager. It is found that each time the advertisement is switched, the racing light will jump and display from scratch, thinking that it is a conflict between viewPager and racing lantern. Later, I searched the Internet for this problem. The solution is to nest a layout control in the outer layer of the racing lantern control.

At this point, I believe you have a deeper understanding of "android racing lights repeatedly beating and how not to roll", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report