How to create TileView on the screen

I want to know the process of creating Tiles on home screen , could you help me

I do not know what you mean by “Tiles on home screen”, sorry.

Do you mean app widgets? Do you mean launcher icons? Do you mean tiles in the notification shade? Do you mean something else?

I have 1 background Image and 1 icon image , I want to insert icon image at a specific part (lower right) of the Background image
Is it possible…

  • set rootlayout to framelayout
  • Set background to R.drawable.yourbackground_picture
  • add an imageview . set src to R.drawable.icon_image
  • set imageview’s layout_gravity as BOTTOM|END

is it possible to call all these from Java class file

setting your layout to framelayout is a choice that you have to take in xml only.
Rest all of them can be done by java.

Framelayout root =findviewbyid(R.id.framelayout_xml_id);
root.setbackgroundDrawable(R.drawable.bg);

//if image view is  already created in xml and is hidden
Imageview iv =f...i...d(R.id.imageview);
iv.setVisibility(View.VISIBLE);
iv.setImageResourceFile(R.drawable.icon_pic);

Some of the method names might be incorrect/not in proper camelCase format as i am on the phone. Also, if you need to even create the imageview in java, then that is also possible

1 Like

Thank you
I want to know What is Layout Inflater, where and how it can be used .

I cover LayoutInflater in the books, such as here and here and here. From that third link:

LayoutInflater knows how to “inflate” layout resources. In Android, “inflate”
means:

  • Walk a tree of XML elements in an XML resource

  • Create Java objects for each element in that tree

  • Stitch those objects together into their own tree structure, mirroring the
    tree defined in the XML

  • Return the Java object representing the root of the tree

We use it for creating rows/cells/whatever in a RecyclerView, for loading the contents of fragments in onCreateView(), etc. Under the covers, things like setContentView(Int) use LayoutInflater, even though we do not use it directly there.