This repo contains the Pixate Freestyle library project.
Pixate Freestyle is a free framework that lets you style your native Android views with stylesheets.
Under the hood, Pixate is a powerful resolution-independent graphics engine which translates familiar CSS markup to scalable graphics and bitmap effects. It is designed to work with your existing assets, as well as with SVG (Scalable Vector Graphics) assets that can be applied to your views just like any other image.
You can either clone this repo or download the package directly from the releases section.
We've tried to make Pixate easy to integrate into any existing app, and there are a few simple steps that need to be done in order to have it integrated with your project.
- In your project settings, make a reference to use the PixateFreestyle library project.
- Initialize Pixate in your Activity or Fragment by making a call to Pixate.init(...). For example:
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// Initialize pixate for the Activity PixateFreestyle.init(this);
// In case it's a Fragment, use: // PixateFreestyle.init(getActivity());
setContentView(R.layout.main); }
3. Create a _'default.css'_ file in your assets directory. This file will hold the styling markup for your app.
### Xamarin.Android
A module is also available (with source code) for using Pixate Freestyle on Xamarin.Android:
* [Xamarin Freestyle Module](https://github.com/Pixate/Xamarin-PixateFreestyle)
### Styling
Pixate enables you to style all Views of the same type by using the View's class name as an element name in the CSS, such as in this example:
```css
button {
background-color: red;
}
However, in most cases you would style a view by its ID (the same one that was defined in the XML layout):
#myButton {
background-color: red;
}
The above example is a very simple one. Pixate also supports advanced styling instructions, like nth-child for Lists, matrix transformations and more.
See the Views Demo blog post to get a taste of what's possible.
The Pixate Freestyle library is a work in progress. At the moment there are a few common views that we've added extensive support to:
- View (generic attributes support for all views)
- ImageView
- TextView
- CheckedTextView
- Button
- CompoundButton
- ImageButton
- ToggleButton
- RadioButton
- CheckBox
- Spinner
- ListView
- GridView
- EditText (support a non-editing mode)
- ActionBar (not in the View's hierarchy, but almost completely supported)
You can find a few sample projects under this repo's Samples folder. These projects use Pixate Freestyle to style various components, and demonstrate the current capabilities of the framework.
Pixate welcomes contributions to our product. Just fork, make your changes, and submit a pull request. All contributors must sign a CLA (contributor license agreement).
To contribute on behalf of yourself, sign the individual CLA here:
http://www.freestyle.org/cla-individual.html
To contribute on behalf of your employer, sign the company CLA here:
http://www.freestyle.org/cla-company.html
All contributions:
- MUST be be licensed using the Apache License, Version 2.0
- authors MAY retain copyright by adding their copyright notice to the appropriate flies
More information on the Apache License can be found here: http://www.apache.org/foundation/license-faq.html
Keep up with notifications and announcements by joining Pixate's mailing list and follow us on Twitter.
You can find the latest Pixate Freestyle documentation here.