Dear Crosswalk team,
I would like to customize the background color of the XWalkView, however, this
seems impossible / non-functional via the setBackgroundColor() API or via XML
Please see below for my implementation details…
As you can see, I would like to have the background set to Blue, however, it
always shows as white. Screenshot is attached.
What do I need to do to be able to set the background color of the XWalkView ?
My Goal is to absolutely avoid the initial white screen, even for a split
second. Once the HTML loads the background color no longer matters.
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.zumobi.xwalkbackgroundtest"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'org.xwalk:xwalk_core_library:14.43.343.17'
}
Layout XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="#FF0000">
<org.xwalk.core.XWalkView
android:id="@+id/xwalkview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0000FF"/>
</RelativeLayout>
Java
public class MainActivity extends ActionBarActivity {
private XWalkView xWalkWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
xWalkWebView=(XWalkView)findViewById(R.id.xwalkview);
// test
xWalkWebView.setBackgroundColor(Color.BLUE);
// test
xWalkWebView.post(new Runnable() {
@Override
public void run() {
xWalkWebView.setBackgroundColor(Color.BLUE);
}
});
}
@Override
protected void onPause() {
super.onPause();
if (xWalkWebView != null) {
xWalkWebView.pauseTimers();
xWalkWebView.onHide();
}
}
@Override
protected void onResume() {
super.onResume();
if (xWalkWebView != null) {
xWalkWebView.resumeTimers();
xWalkWebView.onShow();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (xWalkWebView != null) {
xWalkWebView.onDestroy();
}
}
}
Alexander Biemann / Sr. Android Software Engineer
[email protected]
1525 4th Ave. Ste. 800, Seattle, WA 98101
Zumobi.com
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help