Android Compound View. Simple layout which takes Objects and adjusts them according to item and parent layout width, line by line.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
gradle/wrapper
library
src
.gitignore
README.md
autoadjustmentlayout.iml
build.gradle
gradle.properties
gradlew
gradlew.bat
logo.png
proguard-rules.pro
settings.gradle
smart_screen.png

README.md

AutoAdjustmentLayout

Android custom view which allows to set a List of Objects (extends of View) that will be placed one-by-one whith auto transfering function to the next line, according to items and parent layout width.

alt tag

Features:

  • set/add item(s)
  • remove item dynamically
  • receive callbacks (item has been removed & end achived)

Declare in XML:

  <com.compoundview.autoadjustmentlayout.AutoAdjustmentLayout
            android:id="@+id/autoAdjustmentLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"/>

Code:

AutoAdjustmentLayout autoAdjustmentLayout = (AutoAdjustmentLayout) findViewById(R.id.autoAdjustmentView);
autoAdjustmentLayout.setElementList(ArrayList<Object>);
autoAdjustmentLayout.isRemovable(true);

autoAdjustmentLayout.setAutoAdjustmentLayoutListener(new AutoAdjustmentLayout.IOnAutoAdjustmentLayoutListener() {
          @Override
          public void onItemRemoved(View view) {
          
          }
          @Override
          public void onLastItemRemoved(View view) {
          
          }
        });
  }

To append items dynamically:

autoAdjustmentLayout.addElement(Object);
autoAdjustmentLayout.addElementList(ArrayList<Object>);

To remove item dynamically:

autoAdjustmentLayout.removeElement(Object);

Usage

Maven Central

Add this dependency to your Android project in build.gradle:

dependencies {
  compile 'com.example.autoadjustmentlayout:autoadjustmentlayout:1.3'
}

You may also simply grab a JAR or an AAR from Maven Central. Or use it with Maven:

<dependency>
  <groupId>com.example.autoadjustmentlayout</groupId>
  <artifactId>autoadjustmentlayout</artifactId>
  <version>1.3</version>
  <type>pom</type>
</dependency>

Otherwise, you can download library and append as module to your project.

License

 Copyright 2015 Denys Zhuchinskyi

 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.