CN108153515A - It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution - Google Patents

It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution Download PDF

Info

Publication number
CN108153515A
CN108153515A CN201710394009.9A CN201710394009A CN108153515A CN 108153515 A CN108153515 A CN 108153515A CN 201710394009 A CN201710394009 A CN 201710394009A CN 108153515 A CN108153515 A CN 108153515A
Authority
CN
China
Prior art keywords
edittext
data
recycleradapter
list
methods
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201710394009.9A
Other languages
Chinese (zh)
Inventor
陈林
徐震宇
张来卿
文新
季统凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloud Computing Center of CAS
Cloud Computing Industry Technology Innovation and Incubation Center of CAS
G Cloud Technology Co Ltd
Original Assignee
Cloud Computing Center of CAS
G Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cloud Computing Center of CAS, G Cloud Technology Co Ltd filed Critical Cloud Computing Center of CAS
Priority to CN201710394009.9A priority Critical patent/CN108153515A/en
Publication of CN108153515A publication Critical patent/CN108153515A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to Android set platform technologys field, reviewed after more particularly to a kind of Android platform RecycleView controls editor's data and roll chaotic solution.The method of the present invention is to rewrite the trigger event TextWatcher classes of EditText, and then entity class is added in mDatas data acquisition systems in positon positions passing through in EditText in current sub- layout in the data setting to the Count attributes of entity class that Button changes in its onTextChangeListener method.The present invention solves the problems, such as the data corruption of EditText when the drop-down of RecyclerView views refreshes or rolls.

Description

It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls confusion Solution
Technical field
The present invention relates to Android set platform technologys field, more particularly to a kind of Android platform RecycleView controls It is reviewed after editor's data and rolls chaotic solution.
Background technology
As shown in Figure 1, the RecycleView views with EditText controls are used under Android platform and are loaded During many data, if changing the content in certain upper EditText controls of item layout with Button control at this time, When being easy for causing page scroll the problem of data corruption.
Invention content
Present invention solves the technical problem that it is the provision of in a kind of RecyclerView controls based on Android platform The data of EditText roll method the problem of repeating after control Button is used to change;Particularly drop-down refreshes or rolls When dynamic the problem of the data corruption of EditText.
The present invention solve above-mentioned technical problem technical solution be:
The method is to rewrite the trigger event TextWatcher classes of EditText, and at it The data setting for passing through Button changes in EditText in current sub- layout is arrived in onTextChangeListener methods In the Count attributes of entity class, then entity class is added in mDatas data acquisition systems in positon positions.
The method specifically includes following steps:
Step 1: it creates the main topology file of the activity_list.xml with RecyclerView and carries The sub- topology files of the item_activity_list.xml of EditText controls and Button control;
It inherits the RecyclerViewActivity main classes of ActionBarActivity Step 2: creating, inherit The adapter class of the RecyclerAdapter of RecyclerView.Adapter and entity class ProductEntity;
Step 3: the view RecyclerViewmRecyclerView defined in RecyclerViewActivity classes, suitable Orchestration RecyclerAdapter mAdapter, data acquisition system List < ProductEntity > mDatas etc.;
Step 4: initializing control and data in the onCreate methods of RecyclerViewActivity, and allow MRecyclerView setting adapters mAdapter;
Step 5: creating instance variable ProductEntity mData in RecyclerAdapter, create and inherit The subclass RecyclerViewHolder of ViewHolder;
Step 6: the control in item_activity_list.xml layout is initialized in RecyclerViewHolder Part, defined in the onCreateViewHolder methods in RecyclerAdapter RecyclerViewHoldermHodler, and item_activity_list.xml layout is loaded, it is then back to variable mHodler;
Step 7: the abstract class EditTextWatcher of TextWatcher are inherited in definition, abstract side is created Method onTextChangeListener (Editables, ViewHolder holder), Ran Hou It is called in onTextChangeListener methods;
Step 8: creation method setData (String str, int position), for preserving fixed position Content in EditText;
Step 9: in onBindViewHolder methods in RecyclerAdapter classes, when Button is triggered During onClick events, in the data setting to the count attributes of mData in EditText;Add simultaneously to EditText controls Add addTextChangedListener events, and realize onTextChangeListener methods, call in this method SetData (s.toString (), position) method, in the data setting to data acquisition system in EditText Data mdata.getCount () is finally reset to EditText by positon positions by setText () method again In.
The step is a kind of, and Button is used for dynamically updating the data in EditText controls;
In the step two, entity class has the attributes such as id, name, count.
Beneficial effects of the present invention:It is rolled when the RecycleView views for using Android platform carry out majority according to loading When, the data in the EditText on its current Item are set into entity class, and entity class is added in Position positions It is added in set mDatas, the data that can thus control EditText on current Item positions are constant, solved so as to reach Purpose chaotic during data scrolling in EditText.
Description of the drawings
The present invention is further described below in conjunction with the accompanying drawings:
Fig. 1 rolls chaotic sectional drawing for prior art state;
Fig. 2 is flow chart of the method for the present invention.
Specific embodiment
As shown in Fig. 2, the present invention uses following steps:
Step 1: it creates the main topology file of the activity_list.xml with RecyclerView and carries The sub- topology files of the item_activity_list.xml of EditText controls and Button control, wherein Button are used for dynamic Update the data in EditText controls;Such as:
Main layout:
Son layout:
It inherits the RecyclerViewActivity main classes of ActionBarActivity Step 2: creating, inherit The adapter class and entity class ProductEntity, entity class of the RecyclerAdapter of RecyclerView.Adapter has The attributes such as id, name, count;Such as:
Step 3: view RecyclerView mRecyclerView defined in RecyclerViewActivity classes, Adapter RecyclerAdapter mAdapter, data acquisition system List < ProductEntity > mDatas etc.;Such as:
Step 4: initializing control and data in the onCreate methods of RecyclerViewActivity, and allow MRecyclerView setting adapters mAdapter;Such as:
Step 5: creating instance variable ProductEntity mData in RecyclerAdapter, create and inherit The subclass RecyclerViewHolder of ViewHolder;Such as:
Step 6: the control in item_activity_list.xml layout is initialized in RecyclerViewHolder Part, RecyclerViewHolder defined in the onCreateViewHolder methods in RecyclerAdapter MHodler, and item_activity_list.xml layout is loaded, it is then back to variable mHodler;Such as:
Step 7: the abstract class EditTextWatcher of TextWatcher are inherited in definition, abstract side is created Method onTextChangeListener (Editable s, ViewHolder holder), Ran Hou It is called in onTextChangeListener methods;Such as:
Step 8: creation method setData (String str, int position), for preserving fixed position Content in EditText;Such as:
Step 9: in onBindViewHolder methods in RecyclerAdapter classes, when Button is triggered During onClick events, the data in EditText are set into the count attributes of mData, while is added to EditText controls Add addTextChangedListener events, and realize onTextChangeListener methods, call in this method SetData (s.toString (), position) method, in the data setting to data acquisition system in EditText Data mdata.getCount () is finally reset to EditText by positon positions by setText () method again In.Such as:

Claims (4)

  1. Chaotic solution is rolled 1. being reviewed after a kind of Android platform RecycleView controls editor's data, it is characterised in that: The method is to rewrite the trigger event TextWatcher classes of EditText, and in its onTextChangeListener side Passing through in EditText in current sub- layout in the data setting to the Count attributes of entity class that Button changes in method, so Entity class is added in mDatas data acquisition systems in positon positions afterwards.
  2. 2. solution according to claim 1, it is characterised in that:The method specifically includes following steps:
    Step 1: creating the main topology file of the activity_list.xml with RecyclerView and with EditText The sub- topology files of the item_activity_list.xml of control and Button control;
    It inherits the RecyclerViewActivity main classes of ActionBarActivity Step 2: creating, inherit The adapter class of the RecyclerAdapter of RecyclerView.Adapter and entity class ProductEntity;
    Step 3: view RecyclerView mRecyclerView defined in RecyclerViewActivity classes, adaptation Device RecyclerAdapter mAdapter, data acquisition system List < ProductEntity > mDatas etc.;
    Step 4: initializing control and data in the onCreate methods of RecyclerViewActivity, and allow MRecyclerView setting adapters mAdapter;
    Step 5: creating instance variable ProductEntity mData in RecyclerAdapter, create and inherit The subclass RecyclerViewHolder of ViewHolder;
    Step 6: the control in item_activity_list.xml layout is initialized in RecyclerViewHolder, RecyclerViewHolder mHodler defined in onCreateViewHolder methods in RecyclerAdapter, and Item_activity_list.xml layout is loaded, is then back to variable mHodler;
    Step 7: the abstract class EditTextWatcher of TextWatcher are inherited in definition, abstract methods are created OnTextChangeListener (Editable s, ViewHolder holder), then in onTextChangeListener It is called in method;
    Step 8: creation method setData (String str, int position), for preserving fixed position Content in EditText;
    Step 9: in onBindViewHolder methods in RecyclerAdapter classes, when Button triggers onClick During event, in the data setting to the count attributes of mData in EditText;It is added simultaneously to EditText controls AddTextChangedListener events, and realize onTextChangeListener methods, it calls in this method SetData (s.toString (), position) method, in the data setting to data acquisition system in EditText Data mdata.getCount () is finally reset to EditText by positon positions by setText () method again In.
  3. 3. solution according to claim 2, it is characterised in that:The step is a kind of, and Button is used for dynamic more Data in new EditText controls.
  4. 4. the solution according to Claims 2 or 3, it is characterised in that:In the step two, entity class has id, The attributes such as name, count.
CN201710394009.9A 2017-05-28 2017-05-28 It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution Withdrawn CN108153515A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710394009.9A CN108153515A (en) 2017-05-28 2017-05-28 It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710394009.9A CN108153515A (en) 2017-05-28 2017-05-28 It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution

Publications (1)

Publication Number Publication Date
CN108153515A true CN108153515A (en) 2018-06-12

Family

ID=62468719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710394009.9A Withdrawn CN108153515A (en) 2017-05-28 2017-05-28 It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution

Country Status (1)

Country Link
CN (1) CN108153515A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109343840A (en) * 2018-10-10 2019-02-15 四川长虹电器股份有限公司 The method that mobile terminal camera background carries preview pane
CN109976851A (en) * 2019-03-15 2019-07-05 努比亚技术有限公司 Menu item display methods, wearable device and computer readable storage medium
CN110688114A (en) * 2018-07-05 2020-01-14 武汉斗鱼网络科技有限公司 Method, storage medium, device and system for bridging native list views

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040168150A1 (en) * 2003-02-21 2004-08-26 Sap Ag Method for using a business model user interface
CN106020657A (en) * 2016-05-12 2016-10-12 山东大学 Dragging-moving method of files under same directory for Android system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040168150A1 (en) * 2003-02-21 2004-08-26 Sap Ag Method for using a business model user interface
CN106020657A (en) * 2016-05-12 2016-10-12 山东大学 Dragging-moving method of files under same directory for Android system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KAXI4IT: "RecyclerView中解决EditText的各种异常", 《HTTPS://WWW.MEIWEN.COM.CN/SUBJECT/DRWJNTTX.HTML》 *
STUPID_BOY1103: "recycleview多item布局的实现(简单聊天界面)", 《HTTPS://BLOG.CSDN.NET/STUPID_BOY1103/ARTICLE/DETAILS/59514817?UTM_SOURCE=BLOGXGWZ6》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688114A (en) * 2018-07-05 2020-01-14 武汉斗鱼网络科技有限公司 Method, storage medium, device and system for bridging native list views
CN109343840A (en) * 2018-10-10 2019-02-15 四川长虹电器股份有限公司 The method that mobile terminal camera background carries preview pane
CN109976851A (en) * 2019-03-15 2019-07-05 努比亚技术有限公司 Menu item display methods, wearable device and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN108153515A (en) It is reviewed after a kind of Android platform RecycleView controls editor's data and rolls chaotic solution
US7895599B2 (en) User interface independent remote interface data loader
US20040056896A1 (en) Customizable drag and drop for industrial software applications
US11175931B2 (en) Automated graphical user interface configuration
US8762936B2 (en) Dynamic design-time extensions support in an integrated development environment
US8839100B1 (en) Updating information related to data set changes
CN103941964B (en) Information loading method based on desktop components and intelligent terminal
US20190179680A1 (en) Enhanced processing and communication of file content for analysis
Wang et al. Profiling the responsiveness of android applications via automated resource amplification
CN103902634A (en) Method for achieving automatic binding between View assembly and database fields through Adapter
CN110221899A (en) A kind of adjusting method of user interface, apparatus and system
Plakalovic et al. Applying MVC and PAC patterns in mobile applications
CN106557250A (en) A kind of blank screen treating method and apparatus in a mobile device
US8850354B1 (en) Multi-window web-based application structure
CN105630501A (en) Vehicle-mounted graphical interface system based on QML+OpenGL
WO2014205558A1 (en) Software development using gestures
US7783651B2 (en) Base tree node infrastructure
CN107783886A (en) A kind of method and terminal for obtaining operation frame per second
US9442638B2 (en) Display of data on a device
CN103257788A (en) Windows desktop dynamic icon forming method
CN110209465A (en) Virtual machine cross-platform migration method, device and electronic equipment
CN102508757A (en) Serial port debugging realization method of Linux system
CN110825409A (en) Parameter management method, electronic device, and computer storage medium
US20160216979A1 (en) User initiated data rollback using operating system partitions
WO2019080665A1 (en) View display method, apparatus and device, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20180612