Android Open Source - pixel-art Sliding Linear Layout

From Project

Back to project page pixel-art.


The source code is released under:

Apache License

If you think the Android project pixel-art listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jaween.pixelart.util;
// w w  w.  j av a2 s . c om
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

 * Created by ween on 12/18/14.
public class SlidingLinearLayout extends LinearLayout {

    public SlidingLinearLayout(Context context) {

    public SlidingLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

    public SlidingLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

    public void setYFraction(final float fraction) {
        float translationY = getHeight() * fraction - getHeight();

    public float getYFraction() {
        if (getHeight() == 0) {
            return 0;
        return (getTranslationY() + getHeight()) / getHeight();

Java Source Code List