Arjay
Arjay

Reputation: 55

Buttons, images and more are not showing in Android Studio when you add them

so i'm trying to make an app with buttons, pictures and a tab bar but they don't appear when I drop the button to the virtual phone in android studio. this is the mainactivity.xml. How can I fix this? This is all description I can give. If you need more, just comment ill try my best to give you more description.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0099cc"
    tools:context=".FullscreenActivity">

    <!-- The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc. -->
    <TextView
        android:id="@+id/fullscreen_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:keepScreenOn="true"
        android:text="@string/dummy_content"
        android:textColor="#33b5e5"
        android:textSize="50sp"
        android:textStyle="bold" />

    <!-- This FrameLayout insets its children based on system windows using
         android:fitsSystemWindows. -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <LinearLayout
            android:id="@+id/fullscreen_content_controls"
            style="?metaButtonBarStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            android:background="@color/black_overlay"
            android:orientation="horizontal"
            tools:ignore="UselessParent">

            <Button
                android:id="@+id/dummy_button"
                style="?metaButtonBarButtonStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/dummy_button" />

        </LinearLayout>
    </FrameLayout>

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@color/colorAccent" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <RadioButton
        android:id="@+id/radioButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="RadioButton" />

    <ToggleButton
        android:id="@+id/toggleButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ToggleButton"
        android:visibility="visible" />

    <WebView
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextureView
        android:id="@+id/textureView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</FrameLayout>

Upvotes: 0

Views: 66

Answers (2)

Vishal Sharma
Vishal Sharma

Reputation: 1063

Follow below steps:

  1. Go to your res folder and inside res folder.
  2. Go to values.
  3. Go to style.xml
  4. change <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Upvotes: 0

Rohit Chauhan
Rohit Chauhan

Reputation: 1169

Try this solutions

  1. Invalidate Cache & Restart
  2. Try Changing theme like AppTheme to Material Light or whatever you want
  3. Clean & Rebuild Project

Done Now you can see the element in Virtual Phone of android studio

Upvotes: 1

Related Questions