2

I have this layout which has a circle progress bar, but is not displayed. I take the code on: https://stackoverflow.com/a/5261727/2995941

enter image description here

this is my layout xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="pidaas.vicomtech.org.facerec.MainActivity">


<SurfaceView
    android:id="@+id/surfaceView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/imageView"
    android:layout_centerHorizontal="true"
    android:src="@drawable/calibration_head_b" />

<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Process"
    android:src="@drawable/unlock"
    android:id="@+id/process_act"
    android:layout_alignTop="@+id/photo_act"
    android:layout_toRightOf="@+id/photo_act"
    android:layout_toEndOf="@+id/photo_act"
    android:layout_marginLeft="63dp"
    android:layout_marginStart="63dp" />


<android.support.design.widget.FloatingActionButton
    android:id="@+id/photo_act"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:src="@drawable/icon_camera_128"
    app:layout_anchorGravity="bottom|right|end"
    android:layout_marginBottom="55dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="103dp"
    android:layout_marginStart="103dp" />

<ProgressBar android:indeterminate="true"
    android:layout_width="50dp" android:layout_height="50dp"
    android:id="@+id/marker_progress" style="?android:attr/progressBarStyle"
    android:layout_gravity="center_vertical|center_horizontal"/>

</RelativeLayout>

Progress bar is not displayed, Which is the order to put this progressbar like floating element? May be android version is not taking style ?android:attr/progressBarStyle?

My android support version are these:

  • com.android.support:appcompat-v7:23.2.1

  • com.android.support:design:23.2.1

Thanks in advance.

Community
  • 1
  • 1
uelordi
  • 2,189
  • 3
  • 21
  • 36

1 Answers1

3

I solved my issue:

The problem was in progressbar element.

The order was correctly placed. I added an background atribute, android:background="@null", and Now I can see in the center.

This is the final xml file.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="pidaas.vicomtech.org.facerec.MainActivity">


    <SurfaceView
        android:id="@+id/surfaceView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/imageView"
        android:layout_centerHorizontal="true"
        android:src="@drawable/calibration_head_b" />

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Process"
        android:src="@drawable/unlock"
        android:id="@+id/process_act"
        android:layout_alignTop="@+id/photo_act"
        android:layout_toRightOf="@+id/photo_act"
        android:layout_toEndOf="@+id/photo_act"
        android:layout_marginLeft="63dp"
        android:layout_marginStart="63dp" />


    <android.support.design.widget.FloatingActionButton
        android:id="@+id/photo_act"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:src="@drawable/icon_camera_128"
        app:layout_anchorGravity="bottom|right|end"
        android:layout_marginBottom="55dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="103dp"
        android:layout_marginStart="103dp" />


    <ProgressBar android:indeterminate="true"
        android:layout_width="100dp" android:layout_height="100dp"
        android:id="@+id/marker_progress" style="?android:attr/progressBarStyle"
        android:visibility="visible"
        android:foregroundGravity="center_horizontal"
        android:background="@null"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />
</RelativeLayout>
uelordi
  • 2,189
  • 3
  • 21
  • 36