Skip to content
Android gradient backgrounds for your layouts
Java
Branch: master
Clone or download
csdodd Merge pull request #4 from IvanSimovic/AddedRadius
Added the possibility to set corner radius
Latest commit a59019b Jun 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradientlayout Added the possibility to set corner radius Mar 13, 2018
gradle/wrapper Release v1.2 Nov 15, 2017
sample Added the possibility to set corner radius Mar 13, 2018
.gitignore Update sample to show GradientBackground in Views Nov 16, 2017
LICENSE Commit v1.0 Jun 15, 2016
README.md Release v1.2 Nov 15, 2017
build.gradle Release v1.2 Nov 15, 2017
demo.gif Update sample to show GradientBackground in Views Nov 16, 2017
gradle.properties Commit v1.0 Jun 15, 2016
gradlew Commit v1.0 Jun 15, 2016
gradlew.bat Commit v1.0 Jun 15, 2016
settings.gradle

README.md

GradientLayout

Android Arsenal

A library which extends Android layouts to allow for the easy configuring of gradient backgrounds.

Gradle

dependencies {
    compile 'net.colindodd:gradientlayout:1.2'
}

Usage

<net.colindodd.gradientlayout.GradientRelativeLayout
    xmlns:gl="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    gl:start_color="@color/purple"
    gl:end_color="@color/blue"
    gl:orientation="TOP_BOTTOM">

</net.colindodd.gradientlayout.GradientRelativeLayout>
    final GradientLinearLayout layout = (GradientLinearLayout) view.findViewById(R.id.root);
    layout.setStartColor(Color.rgb(255,87,34))
          .setEndColor(Color.rgb(255,193,7))
          .setOrientation(GradientDrawable.Orientation.TR_BL);

Or just provide a single color and the layout will generate a gradient for you:

    final GradientLinearLayout layout = (GradientLinearLayout) view.findViewById(R.id.root);
    layout.setEndColor(Color.rgb(123,31,162));

Orientation is the same as GradientDrawable.Orientation

The following classes are included:

  • GradientAbsoluteLayout
  • GradientFrameLayout
  • GradientGridLayout
  • GradientLinearLayout
  • GradientRelativeLayout
  • GradientTableLayout

License

Copyright 2016 Colin Dodd

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.