-
Notifications
You must be signed in to change notification settings - Fork 14
Customizing your hybrid views on Android
cobaltians edited this page May 15, 2014
·
5 revisions
By default, CobaltFragment
inflates a minimalist XML layout named fragment_cobalt
which provides a fullscreen transparent container for your Web view.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/web_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" />
You can also create your own and override the getLayoutToInflate
method of your CobaltFragment
to let Cobalt inflate it:
@Override
protected int getLayoutToInflate() {
return R.layout.fragment_my;
}
If you create your own XML layout, you must define a Web view container with id web_view_container
. You can also use any name and override the getWebViewContainerId
method of your CobaltFragment
.
@Override
protected int getWebViewContainerId() {
return R.id.web_view_container_my;
}
Moreover, you can override setUpViews
and setUpListeners
methods to bind UI elements defined in your XML layout with your CobaltFragment
code and add listeners to them.
Cobalt is an Open-Source Hybrid Mobile Framework. Read more about it on the home page or in the documentation
- Introduction to Cobalt navigation
- The cobalt.json file
- native navigation bars
- Handling the Android back button
- Introduction to Cobalt messages
- Publish/Subscribe on the Web side
- Publish/Subscribe on Android
- Publish/Subscribe on iOS
- Web Lifecycle messages
- Pull-To-Refresh and Infinite Scroll
- Custom alerts and Toasts
- LocalStorage
- OpenExternalUrl
- PlatformInfos
- Ajax
- Removing the top bar
- Adding Cobalt to an existing project
- Customizing your hybrid views
- Handle multiple Cobalt webviews on the same screen (TODO)