0
TextView not appearing in Android App
I'm creating an Android app. Removing the default toolbar the Android Activity provides, I decided to use my own with widget.Toolbar. This made the toolbar centered both horizontally and vertically due to the style of its wrapper <LinearLayout>. Setting layout_gravity for Toolbar to override that and align the toolbar to top worked, but now the text isn't appearing anymore. What do I do? And why is the text not appearing? Code referring to, below: https://sololearn.com/compiler-playground/WcV0MAbqWAz5/?ref=app
2 Answers
+ 2
You need to define some layout margins for that TextView. It's probably hidden behind the Toolbar.
+ 1
Ace Add android:orientation="vertical" to LinearLayout so the children stack on top of each other. The toolbar and text are likely overlapping as Jan said. Since the toolbar isn't at center and is at top, change "center" to "center_horizontal" in android:gravity in Linearlayout. If you want the TextView to be centered in the interface, wrap it in another LinearLayout and set android:gravity to center there.