2017-10-10 5 views
0

Je développe l'application qui devrait utiliser le tiroir de navigation comme un menu bur pour une meilleure expérience utilisateur, j'ai décidé de remplacer le tiroir de navigation avec panneau vers le haut.Android - Slide Up Panel (bibliothèque) coins arrondis


Selon moi, dans cette image


enter image description here


Maintenant, je veux faire de ce menu avec des coins arrondis je l'ai utilisé avec l'attribut cornerRadius Vignettes mais n'a pas travaille correctement.


Ceci est mon code XML pour le glisser vers le haut panneau

<com.sothree.slidinguppanel.SlidingUpPanelLayout 
 
     xmlns:sothree="http://schemas.android.com/apk/res-auto" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="match_parent" 
 
     android:gravity="bottom" 
 
     sothree:umanoPanelHeight="0dp" 
 
     sothree:umanoShadowHeight="0dp" 
 
     android:id="@+id/SlidingUpPanel"> 
 

 
    
 
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

La même conception peut être vu dans Facebook app messenger:


enter image description here


Toute idée sera la bienvenue, Merci à l'avance ...

PS: Le lien de la bibliothèque que j'utilise: Github library

Ceux qui veulent tous la mise en page:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
xmlns:app="http://schemas.android.com/apk/res-auto" 
 
android:layout_width="match_parent" 
 
android:layout_height="match_parent" 
 
android:orientation="vertical"> 
 

 
<include 
 
    android:id="@+id/toolbar" 
 
    layout="@layout/toolbar" /> 
 

 

 
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto" 
 
    android:id="@+id/SlidingUpPanel" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="match_parent" 
 
    android:gravity="bottom" 
 
    sothree:umanoPanelHeight="0dp" 
 
    sothree:umanoShadowHeight="0dp"> 
 

 
    <android.support.v7.widget.RecyclerView 
 
     android:id="@+id/recyclerView" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="match_parent" 
 
     android:background="#345D7D" /> 
 

 

 
    <LinearLayout 
 
     android:layout_width="match_parent" 
 
     android:layout_height="300dp" 
 
     android:orientation="vertical"> 
 

 

 
     <LinearLayout 
 
      android:layout_width="match_parent" 
 
      android:layout_height="0dp" 
 
      android:layout_weight="0.5" 
 
      android:orientation="horizontal"> 
 

 
      <RelativeLayout 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent" 
 
       android:layout_weight="0.33333"> 
 

 
       <ImageButton 
 
        android:layout_width="100dp" 
 
        android:layout_height="100dp" 
 
        android:layout_centerInParent="true" 
 
        android:background="?attr/selectableItemBackgroundBorderless" 
 
        android:scaleType="fitXY" 
 
        android:src="@drawable/quran_icon" /> 
 

 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent" 
 
       android:layout_weight="0.33333"> 
 

 
       <ImageButton 
 
        android:layout_width="125dp" 
 
        android:layout_height="125dp" 
 
        android:layout_centerInParent="true" 
 
        android:background="?attr/selectableItemBackgroundBorderless" 
 
        android:scaleType="fitXY" 
 
        android:src="@drawable/qibla_compass_icon" /> 
 

 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent" 
 
       android:layout_weight="0.33333"> 
 

 
       <ImageButton 
 
        android:id="@+id/findMyLocation" 
 
        android:layout_width="100dp" 
 
        android:layout_height="100dp" 
 
        android:layout_centerInParent="true" 
 
        android:background="?attr/selectableItemBackgroundBorderless" 
 
        android:scaleType="fitXY" 
 
        android:src="@drawable/location_icon" /> 
 

 

 
      </RelativeLayout> 
 

 
     </LinearLayout> 
 

 
     <LinearLayout 
 
      android:layout_width="match_parent" 
 
      android:layout_height="0dp" 
 
      android:layout_weight="0.5" 
 
      android:orientation="horizontal"> 
 

 

 
      <RelativeLayout 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent" 
 
       android:layout_weight="0.33333"> 
 

 
       <ImageButton 
 
        android:layout_width="100dp" 
 
        android:layout_height="100dp" 
 
        android:layout_centerInParent="true" /> 
 

 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent" 
 
       android:layout_weight="0.33333"> 
 

 
       <ImageButton 
 
        android:layout_width="100dp" 
 
        android:layout_height="100dp" 
 
        android:layout_centerInParent="true" /> 
 

 
      </RelativeLayout> 
 

 

 
      <RelativeLayout 
 
       android:layout_width="0dp" 
 
       android:layout_height="match_parent" 
 
       android:layout_weight="0.33333"> 
 

 
       <ImageButton 
 
        android:layout_width="100dp" 
 
        android:layout_height="100dp" 
 
        android:layout_centerInParent="true" /> 
 

 
      </RelativeLayout> 
 
     </LinearLayout> 
 

 

 
    </LinearLayout> 
 

 

 
</com.sothree.slidinguppanel.SlidingUpPanelLayout> 
 

 

 
</LinearLayout>

Répondre

0

Créer une nouvelle ressource drawable comme

drawable_round_background.xml: 
<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <corners android:topLeftRadius="16dp" 
     android:topRightRadius="16dp"/> 
    <solid android:color="#FFFFFF" /> 
</shape> 

et définir les drawable_round_background.xml en arrière-plan à votre disposition glisser comme:

<com.sothree.slidinguppanel.SlidingUpPanelLayout 
    xmlns:sothree="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="bottom" 
    sothree:umanoPanelHeight="0dp" 
    sothree:umanoShadowHeight="0dp" 
    android:id="@+id/SlidingUpPanel"> 

    <!-- SLIDING LAYOUT --> 
    <LinearLayout android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/drawable_round_background"> 
    </LinearLayout> 
</com.sothree.slidinguppanel.SlidingUpPanelLayout> 

espère que cela Aidez-moi .

+0

Je suis désolé, mais rien ne se passait ... –

+0

@TarlanAhadli puis-je voir l'ensemble de votre layout.xml? parce que le mien fonctionne bien. – Jerrol

+0

Mise en page complète du code xml ajouté –

0

glisser vers le haut panneau nécessite l'attribut:

sothree:umanoOverlay="true"

Pour superposer mises en page.


Au moyen de cet attribut, nous pouvons non seulement faire le panneau arrondi (Avec CardView), mais aussi mis en fond transparent à slideuppanel.

Référence: Github transparent background (Issues)