2016-06-08 4 views
2

Ich habe dieses Layout, das einen Kreis Fortschrittsbalken hat, aber nicht angezeigt wird. Ich nehme den Code auf: https://stackoverflow.com/a/5261727/2995941Android: Layout floating Element Reihenfolge mit Kreis progressbar

enter image description here

das ist mein 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> 

Fortschrittsbalken nicht angezeigt wird, das ist die Reihenfolge, wie schwebende Element dieses progressbar zu setzen? Kann sein, Android-Version nimmt nicht Stil? Android: Attr/ProgressBarStyle?

Meine Android-Support-Version sind diese:

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

  • com.android.support:design:23.2.1

Vielen Dank im Voraus.

Antwort

3

ich mein Problem gelöst:

Das Problem in progressbar Element war.

Die Bestellung wurde korrekt platziert. Ich habe ein Hintergrundattribut, Android: background = "@ null", und jetzt kann ich in der Mitte sehen.

Dies ist die endgültige XML-Datei.

<?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> 
Verwandte Themen