Why textView “Hello world!” isn't showing on s

2019-04-13 00:21发布

I am trying to add more TextViews but they are not appearing on screen and it tells me "This view is not constrained. It only has design time positions, so it will jump to (0,0) at runtime unless you add the constraints".

Photo: photo photo

3条回答
Evening l夕情丶
2楼-- · 2019-04-13 00:30

Try this code

 1- Go to your res folder and inside res folder.
     2-Go to values.
     3-Go to style.xml
     4-change  <!-- Base application theme. -->
         <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
     to <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
查看更多
▲ chillily
3楼-- · 2019-04-13 00:36

Android Studio 3.1.3, launching the "Start a new Android Studio Project" wizard and accepting the defaults results in the image the OP show. There is a "Hello World" TextView in a Constraint Layout but it is not seen in the activity_main.xml design view. The "Hello World" TextView does appear in my emulator...so it's there (in emulator)...it's just not here (in the IDE).

I have been using the solution provided in this answer: https://stackoverflow.com/a/47611939/1437920. Which basically adds the word "Base" to the appTheme URL.

Slightly annoying to have this odd bug be the greeting for those beginning their Android programming journey. As yet I'm not sure why that URL/classpath is missing the "Base" directory but I'm not interested enough at this time to go beyond the solution cited.

查看更多
甜甜的少女心
4楼-- · 2019-04-13 00:49

You'll have to define the Layouts first and keep your Views(TextView , Imageviews etc ) inside that .Posting your xml code would be helpful to debug .

查看更多
登录 后发表回答