Android Kindle fire webview background is showing black

1

Actually I have one problem kindle fire webview showing background black where I make it transparent. In samsung galaxy s4 or other device it looks good.. only I got problem in kindleFire hd device.

activity_display_help_option_screen.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/rlDisplayHelpOption"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/img_bg_about_settings" >

    <RelativeLayout
        android:id="@+id/rlSplashBg"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <WebView
            android:id="@+id/webViewHelp"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="5dp"
            android:background="@android:color/transparent" />
    </RelativeLayout>

</RelativeLayout>

HelpScreen.java

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;



public class HelpScreen extends BaseActivity
{
    // Header Component
    private ImageView imgSliderOpen;
    private ImageView imgHelpIcon;
    private RelativeLayout rlDisplayHelpOption;

    // WebView.,
    private WebView webViewHelp;
    private TextView txtHelpHeader;
    private int Choice;
    private ImageView imgUATLogo;

    private ImageView imgBaboon;
    private final Animation fromTranslateAnimation = null;
    private final Animation endTtanslateAnimation = null;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.activity_display_help_option_screen);
        this.initHeaderComponent();
        this.initViewControl();

        this.loadHtmlFileInWebView(1);
    }

    /**
     * Initialization view control. 
     */
    private void initViewControl()
    {

        this.rlDisplayHelpOption = (RelativeLayout) this.findViewById(R.id.rlDisplayHelpOption);

        this.txtHelpHeader = (TextView) this.findViewById(R.id.txtHelpHeader);
        this.txtHelpHeader.setTypeface(RiggedJumbleApplication.Fonts.JUNGLE_FEVER);

        this.imgUATLogo = (ImageView) this.findViewById(R.id.imgUATLogo);
        this.imgUATLogo.setVisibility(View.GONE);

        this.webViewHelp = (WebView) this.findViewById(R.id.webViewHelp);
        this.webViewHelp.getSettings().setJavaScriptEnabled(true);

        if (Build.VERSION.SDK_INT >= 11)
        {
            this.webViewHelp.setBackgroundColor(0x01000000);
            webViewHelp.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
        }
        else
        {
            this.webViewHelp.setBackgroundColor(0x00000000);
            // webViewHelp.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
        }
        // Only hide the scrollbar, not disables the scrolling:
        this.webViewHelp.setVerticalScrollBarEnabled(false);
        this.webViewHelp.setHorizontalScrollBarEnabled(false);

    }

    /**
     * Initialization header view control.
     */
    private void initHeaderComponent()
    {
        this.imgSliderOpen = (ImageView) this.findViewById(R.id.imgSliderOpen);
        this.imgSliderOpen.setVisibility(View.VISIBLE);
        this.imgSliderOpen.setImageResource(R.drawable.img_header_slider_back);
        this.imgSliderOpen.setOnClickListener(this.btnClickLister);
        this.imgHelpIcon = (ImageView) this.findViewById(R.id.imgHelp);
        this.imgHelpIcon.setVisibility(View.GONE);
        this.imgHelpIcon.setOnClickListener(this.btnClickLister);
    }

    /**
     * Button Click handler.
     */
    private final OnClickListener btnClickLister = new OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            switch (v.getId())
            {
            case R.id.imgSliderOpen:
                HelpScreen.this.isPlaySoundFile(HelpScreen.this, UatSoundMusicConstant.SOUND_CLICK);
                HelpScreen.this.finish();
                break;
            }
        }
    };

    /**
     * 
     */
    private void loadHtmlFileInWebView(int index)
    {
        switch (index)
        {
        case 1:
            this.imgUATLogo.setVisibility(View.GONE);
            this.txtHelpHeader.setText("TERMS");
            this.webViewHelp.loadUrl("file:///android_asset/HtmlFiles/doc_terms.html");
            break;
        default:
            break;
        }
    }
}

Samsung S4 Image in which webview showing perfect

Kindle Fire webview background showing black

  1. Samsung S4 Webview Working Proper

  2. Kindle Fire Webview background showing black position behind text problem.

android
webview
kindle-fire
asked on Stack Overflow Apr 29, 2014 by Jigar Brahmbhatt • edited Mar 3, 2019 by Cœur

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0