简体   繁体   中英

How does the Android Studio autocomplete works in RecyclerView's `app:layoutManager`?

I'm trying to add a custom view where I'm able to receive the path of the class by an attribute and create it in runtime and I want it to work like the app:layoutManager in RecyclerView , if you try to add the path of your class, Android Studio shows the autocomplete and even the . works. . How??

android studio 自动完成

It's not a question about adding attributes , I already had a look the RecyclerView code and it is receiving a string and then, the string is used to create the instance in runtime.

在此处输入图像描述

在此处输入图像描述

I would be really thankful if someone can help me with this.

  • I think it depends on the IDE and the best answer that i can give you is that it searches throw the children of the top class.
  • For example androidx is the top class so it will search throw it's children, then recyclerview and it will go throw it like this.
  • I'm not sure but i think it's using some kind of decision tree algorithm and you can see here for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM