1

I have framed layout with ImageView, SurfaceView and control elements as overlaying ImageView. So, a SurfaceView is used to play media with MediaPlayer, and ImageView is used then MediaPlayer preparing media as a still image. Then OnPrepared ImageView with still image setVisibility - GONE and we play video. The problem is with control ImageViews. As they a png images with transparent graphics then overlaying on ImageView transparent area looks good, but then MediaPlayer playing video, transparent area of graphics look very tinted like we disable this controls...

Please help me in advise how to make controls to look the same overlaying ImageView and SurfaceView.

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/FrameLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

<SurfaceView
    android:id="@+id/svMain"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

<ImageView
    android:id="@+id/ivMain"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="fitXY"
    android:src="@drawable/still_image" />

<RelativeLayout
    android:id="@+id/controls"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom" >

    <ImageView
        android:id="@+id/ibtnStart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:clickable="true"
        android:onClick="ibtnClick"
        android:src="@drawable/start_image" />

    <ImageView
        android:id="@+id/ibtnStop"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:clickable="true"
        android:onClick="ibtnClick"
        android:src="@drawable/stop_image" />

</RelativeLayout>

</merge>
Natali
  • 2,934
  • 4
  • 39
  • 53
wizemanold
  • 181
  • 1
  • 6
  • Did you ever find a solution to this problem? I have been having the same issue for quite some time without resolution... – Daniel Smith Jan 18 '13 at 20:44

2 Answers2

0

i dunno how much this will help, but u can try setting the background colour of controls using

controls.setColor(Color.argb(00, 0, 0, 0));

The first arguments indicate alpha values responsible for transperency. setit to 00 values range from 00-255

Ajay
  • 1,796
  • 3
  • 18
  • 22
  • maybe if you could upload a screen shot of how it is now,we can understand better what you want... – Ajay Apr 04 '12 at 17:26
  • Strange, but I can't make normal screen shot while MediaPlayer is playing on SurfaceView, got a blank screen with only my controls at one.. – wizemanold Apr 05 '12 at 05:40
0

You can try:

ImageView logo = (ImageView) findViewById(R.id.logo);
logo.setAlpha(110);
Chronos
  • 1,972
  • 17
  • 22
  • This not help, whole image now transparent but again overlaying SurfaceView and ImageView looks a different... Maybe MediaPlayer is used some other alpha blending than ImageView? – wizemanold Apr 03 '12 at 17:23