Buttons or items in android studio are not displayed

0

I am starting to create an application in Android Studio and I can not show the buttons or elements in the image preview.

I attach captures and current code.

CODE xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>

<Button
    android:id="@+id/btnagregar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/add"/>

<ListView
    android:id="@+id/lvlista"
    android:layout_width="match_parent"
    android:layout_height="match_parent"></ListView>

</LinearLayout>

As mentioned previously, nothing is shown in the preview on the right.

I hope you can help me, I remain attentive to your comments.

TECHNICAL INFORMATION:

  • Nexus 5 Team
  • API 28
  • Android Studio Version 3.1.4
asked by GOHANCKZ 22.09.2018 в 23:14
source

3 answers

0

it worked for me: 1.-Changed the device in which you are doing the pre-visualization 2.- Try to change the view to "blueprint" something I do not remember that makes it cool a bit the pre-visualization 3.-Or the API also tries to change it for a lower one

    
answered by 22.09.2018 в 23:31
0

a question, when you created the button and the ListView did it from the code or from the design tab? And have you already executed it in the emulator or on your own device? Also from experience I tell you that the Android Studio environment usually fails and it is not your fault, you can try to restart the environment and if that does not work, in the "build" tab you select the rebuild project option, which regenerates some files that maybe are causing the problem, I hope you can solve it.

    
answered by 22.09.2018 в 23:37
0

The solution was the following:

Change the version of api 28 to api 26

and configure the file build.gradle (module app) leaving this line as follows:

 implementation 'com.android.support:appcompat-v7:26.0.0'

then click on synchronize in a tab that appeared. and ready.

    
answered by 23.09.2018 в 02:22