Android Development (Add a text View)

Add a text view

Divyendra Rajawat
1 min readMar 30, 2021
Photo by Masakaze Kawakami on Unsplash

The new activity includes a blank layout file. Follow these steps to add a text view to where the message appears:

  1. Open the file app > res > layout > activti_display_message.xml.
  2. Click Enable Autoconnect to Parent in the toolbar. This enables Autoconnect.
  3. In the Palette panel, click Text, drag a TextView into the layout, and drop it near the top-center of the layout so that it snaps to the vertical line that appears. Autoconnect adds left and right constraints in order to place the view in the horizontal center.
  4. Create one more constraint from the top of the text view to the top of the layout, so that it appears as shown in figure 1.

Optionally, you can make some adjustments to the text style if you expand textAppearance in the Common Attributes panel of the Attributes window, and change attributes such as textSize and textColor.

--

--