banner



How To Upload Images To Etsy From Android

Add images to your Android Project

We're now going to add a picture to Android Studio. This picture will be used in an Image View.

Starting time, download this flick: (Right click and select Salvage Paradigm As.)

Picture of Tower Bridge

Salvage it to your own computer and recall where you saved it to.

We need to import this flick into the res > drawable folder. Open up your Project Explorer over again by clicking its tab:

Close the Project window in Android Studio

Now expand the res item and locate the drawable folder:

The Android drawable folder

Right click the drawable folder, and select Show in Explorer from the carte:

Menu with Show in Explorer highlighted

This will open a window showing a list of folders. The image beneath is from Windows x:

Windows Explorer showing a list of Android folders

All of these folders are from your res directory. (The mipmap ones are used mainly for icons. You tin create them in different sizes. Nosotros'll practise this much afterwards in the form.)

What you need to do is to copy and paste your image from where you saved it on your reckoner into the drawable folder (we're assuming you lot know how to copy and paste files from one folder to another):

An image copied to the drawable folder of Android Studio

Now become back to Android Studio and y'all should see it there:

An image copied to res > drawable

We tin now use this image in our app.

Go back to your blueprint. Locate the Paradigm View command in the Palette, which is under Images in before versions of Android Studio:

The ImageView widget in the Palette

In afterward versions of Android Studio, you tin detect the Image View control under the Common category of the Palette (and nether Widgets):

The ImageView widget in the Palette in Android Studio 3

Drag an Epitome View to just below your Text View. As soon every bit yous do, yous should the following dialogue box announced:

The Resources dialogue box

Aggrandize the Project item of Drawable and select the bridge epitome and click OK. Your blueprint volition so await like this:

Android Studio layout showing an ImageView on a Blueprint

As you can see, the Paradigm View has ended upwards in the top left. We don't want information technology at that place.

With the Image View selected, click anywhere inside of it with your left mouse button. Go along the left mouse button held down and drag it below the Text View:

ImageView repositioned

(Yous won't exist able to see the image itself in Pattern View.)

Now nosotros'll add a Constraint. We want to connect the top middle circle of the Epitome View to the lesser heart circle of the Text View. Concord your mouse over the top centre circle of the Image View. It will plough light-green. Now hold your left mouse button down. Keep it held down and drag to the lesser middle circle of the Text View:

Dragging from one Constraint Anchor to another

You lot should meet a blue pointer connecting the two:

A Constraint added using Android  Studio

Now add a constraint from the left of the Image View to the left edge of the screen, just like you did for the Text View. Likewise, connect the right edge of the Image View to the correct edge of the screen. Your design will then look like this:

Adding left and right constraints

It can be a little scrap fiddly, and then don't forget you can undo with CTRL + Z.

If yous accept a look at the properties area over again, yous may be wondering what all those lines are for:

The ImageView Properties area

The straight lines betoken which sides of your view are constrained, and to where. They as well tell you the size of the margins, 8 in the prototype above. Agree your mouse over one of the lines and you'll see a dropdown list. Yous can change your margins from here:

Changing the margins via the Properties area

The other lines to be aware of are the ones within the square, pointy arrows in the image above. There are three unlike settings here:

Wrap Contents
Stock-still
Match constraints

Click the arrows to see what they do. Sentinel what happens to the Image View when yous click a set of arrows. In the image beneath, we've prepare the arrows to Fixed:

A Fixed constraint

The arrows have turned into straight lines. Detect that layout_width value has changed to 200dp. It has inverse to 200 because that was the width of the image we used. Notice that the Image View hasn't inverse its size. Merely motion the horizontal slider from 50 to something else. Lookout man what happens to your Image View in the blueprint.

Click the straight lines inside the foursquare to see the third of the settings, Match Constraints:

The Match Constraints setting

Notice that image has now stretched to the margins of the screen. Detect, too, that the layout_width has been reset to cipher. Click over again, though, to go back to Wrap Contents.

In the next lesson, you lot'll learn about a different type of layout - LinearLayout.

Back to the Android Contents Page

Source: https://www.homeandlearn.co.uk/android/adding_images_to_android.html

Posted by: robertrathany.blogspot.com

0 Response to "How To Upload Images To Etsy From Android"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel