9

I'm relatively new to Android and stuck with this problem. I need to create a UI with a graphical binary tree. Tree nodes contain some text and a small image. I went through the Android developer guide, but couldn't find a way to do this.

Is it possible to draw a binary tree in Android? If it is, what controls should I use? If possible please tell me where I can find more information as well.

John Threepwood
  • 15,593
  • 27
  • 93
  • 149

3 Answers3

4

I think implementing the onDraw is your best bet here since you need a lot of customization and there is no default component for it. Please refer to the documentation on how to do it.

Here is a library which implements binary tree so you can check out how they are drawing it.

Hope it helps!

Vikasdeep Singh
  • 20,983
  • 15
  • 78
  • 104
Natan
  • 1,867
  • 13
  • 24
1

I think you should subclass the View class and implement onDraw(Canvas) method http://developer.android.com/guide/topics/ui/custom-components.html

viplezer
  • 5,519
  • 1
  • 18
  • 25
0

Use "de.blox.treeview:treeview:0.1.0" library. You can find how to do it on Geeks For Geeks.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33288368) – Vojin Purić Dec 01 '22 at 16:34