2017-03-24 3 views
-1

enter image description hereComment rendre l'affichage transparent?

De photo ci-dessus fixé comme j'ai besoin, comme indiqué dans la vue rectangle.so vert sera transparent que je fais comme @ null, @ couleur/transparent, mais ne correspondait pas à mon exigence.

Ceci est mon exigence: -

<?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" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context="com.example.admin.mainapp.MainActivity"> 


<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="false"> 

    <FrameLayout 
     android:id="@+id/player_surface_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_gravity="center" 
     android:foregroundGravity="clip_horizontal|clip_vertical" 
     tools:ignore="true"> 

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


    </FrameLayout> 


</FrameLayout> 


<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:background="#10000000" 
    android:layout_alignParentBottom="true"> 

    <ImageView 
     android:id="@+id/screenshot" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="left" 
     android:paddingLeft="5dp" 
     android:src="@mipmap/ic_launcher" /> 

    <ToggleButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:layout_gravity="center_vertical" /> 


    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="right|center_vertical" 
     android:foregroundGravity="right" 
     android:paddingRight="5dp" 
     android:background="@mipmap/ic_launcher" 
     android:text="sasa" /> 
</LinearLayout> 

Ceci est mon attaché code.There est surfaceLayout qui a un fond noir et une disposition linéaire en dessous des boutons (on/off) vidéo donc j'ai besoin de cette vue sera en quelque sorte transparent.

+1

Essayez de régler 'background color' sur' black' et 'android: alpha =". 6 "' pour changer son opacité .. –

+1

http://stackoverflow.com/a/17239853/7320259 prendre couleur de vue as noir et ensuite donner la transparence ency selon votre besoin du lien. Par exemple # 80000000 –

+0

Non c'est encore le même problème, il n'a pas changé. –

Répondre

0

vous pouvez utiliser le code ci-dessous,

<RelativeLayout 
    android:id="@+id/footer_ad" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:layout_alignParentBottom="true" 
    android:background="#151515" 
    android:alpha=".3"></RelativeLayout> 
+1

cette réponse est déjà donnée dans le commentaire –

+0

@Zaki Pathan, j'écris un échantillon de ligne pour plus frais. En cmts seulement dit ensemble alpha. –

0

Hii s'il vous plaît vérifier,

<FrameLayout 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"> 


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


    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_gravity="bottom" 
     android:background="#33000000" 
     android:gravity="center"> 

     <ImageView 
      android:id="@+id/screenshot" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="left" 
      android:paddingLeft="5dp" 
      android:src="@mipmap/ic_launcher" /> 

     <ToggleButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:gravity="center" /> 


     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right|center_vertical" 
      android:background="@mipmap/ic_launcher" 
      android:foregroundGravity="right" 
      android:paddingRight="5dp" 
      android:text="sasa" /> 
    </LinearLayout> 
</FrameLayout> 

je ne pouvais pas comprendre ce que vous voulez vraiment, mais ce pourrait être ce que vous aviez besoin .Si pas s'il vous plaît mentionner ci-dessous