Skip to content
Yannick Signer edited this page Jun 30, 2015 · 2 revisions

Default usage

Let's say, you have a normal layout and you want to display the DriveImageView right away. You can use the following code to add it to your layout.

<ch.haclyon.driveimageview.DriveImageView
    android:id="@+id/driveImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true" />

After this is done, you then need to set some settings to the object. So first cast it from your view:

DriveImageView driveImageView = (DriveImageView) rootView.findViewById(R.id.driveImageView);

After that, we set some basic settings to the DriveImageView. We do this via the DriveImageModel to set the main-text, the folder-text and the image.

driveImageView.setDriveImageModel(new DriveImageModel("main text", "small text", R.drawable.image));

When you launch your app now, then it should look similar to this:

default example ##FolderCorner This sets the height and the width of the “crack” in the divider line, where then the folder text is located. The value is in dp and later gets converted into pixels for the canvas.

driveImageView.setFolderCorner(20.0f)

##Custom FolderSpacing This sets the space from the left side of the image to the right side of the folder crack.

driveImageView.setCustomFolderSpacing(200.0f)

##Custom Height This sets the custom height of the whole figure that is in front of the ImageView.

driveImageView.setCustomHeight(200.0f)

##Image ScaleType This is something that I added after it turned out to be really useful in the android-square-progressbar. You can set the ScaleType of the ImageView to maybe make the image it contains look a bit better.

driveImageView.setImageScaleType(ImageView.ScaleType.CENTER)

##Alpha Value This sets the opacity value of all the figures on the canvas. The value should be between 0f and 1f.

driveImageView.setAlphaValue(0.7f)

##Text Color This sets the colour of the text. This includes the colours of both the main and the folder text.

driveImageView.setTextColor("#C9C9C9")

##Divide Color This sets the colour of the divider-part of the figure.

driveImageView.setDivideColor("#C9C9C9")

##Background Color This sets the background colour of the main figure (without the divider part).

driveImageView.setBackgroundColor("#C9C9C9")

Clone this wiki locally