Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android app with CSS [closed]

Tags:

android

css

How can I use CSS in my Android app?

like image 590
Android Avatar asked May 09 '11 06:05

Android


People also ask

Does Android apps use CSS?

If you want to style a native android app, there is no support for CSS. Instead android has it's own mechanism. The complete list of options is only available at the source code. You may use WebViews in your native Android app, to display HTML which is packaged with the app, then you can use CSS like in any HTML site.

Can you build a mobile app with HTML and CSS?

Native app development from the ground up necessitates particular technologies for both platforms. HTML, CSS, and JavaScript are all that are required for a PWA.

What apps use CSS?

QuickEdit Text Editor is a great app for HTML and CSS coding on Android. It offers a variety of features that make coding easier, such as syntax highlighting, code completion, and error checking. QuickEdit also has a built-in file manager so you can easily access your files and folders.

Which method is called when app is closed?

A Service method onTaskRemoved will be called when we remove app from recent items.


2 Answers

If you want CSS-like style guiding for Android native apps, consider using Scaloid library, which is I wrote :D

For example:

new SVerticalLayout {
  style { 
    case b: SButton => b.textColor(Color.GREEN).onClick(toast("Bang!"))
    case t: STextView => t.textSize(17 dip)
    case v => v.backgroundColor(Color.BLUE)
  }

  STextView("I am 17 dip tall")
  STextView("Me too")
  STextView("Oh, I am taller than you").textSize(24 dip) // overriding
  SEditText("Am I blue?")
  SButton("I am a green monster!")
}

It is simple, expressive and type-safe. This example came from the Scaloid blog:

http://blog.scaloid.org/2013/01/a-css-like-styling-on-android.html

like image 130
pocorall Avatar answered Oct 17 '22 07:10

pocorall


Native Apps

If you want to style a native android app, there is no support for CSS. Instead android has it's own mechanism.

Here's an introduction: http://developer.android.com/guide/topics/ui/themes.html

The complete list of options is only available at the source code.

Native App with local HTML

You may use WebViews in your native Android app, to display HTML which is packaged with the app, then you can use CSS like in any HTML site.

  • Loading an Android resource into a webview

Using special frameworks

There are frameworks which enable you to implement mobile apps with HTML, CSS and JavaScript. They compile it into native apps to allow usage of phone features like gyroscope.

  • Comparison between Corona, Phonegap, Titanium

Web Apps

Web Apps are HTML sites, which are optimized for mobile phones. Of course you can use CSS for your site. An example for mobile optimizations is an offline mode, which uses HTML5's storage mechanisms to bridge connection gaps.

like image 30
Christian Strempfer Avatar answered Oct 17 '22 08:10

Christian Strempfer