How can I drag images onto the canvas? - android-studio

I am working on an app that loads an image and paints it in a camvas to edit it, but I want to add a section where I show a list of images and the user can drag and drop the image on the canvas, but I am locked in the latter function someone have an example or a way to perform this function?

this Android Developers tutorial covers just what you need - a drag and drop process of an image. If you want an even more detailed tutorial, this Android Developers page explains it well.
In short, you have to use the onTouchEvent method inherited from the View class in order to detect and apply the Drag and Drop process.

Related

Android Menu coming from bottom like Google Drive

I have a floating action button and when the users taps on it I want a layout to be shown, animating from the bottom exactly like the Google Drive app (so not covering the whole screen).
I read someone suggest the open source Umano's AndroidSlidingUpPanel but that is more similar to the Google Play Music app and I don't want that as I don't need the panel to be draggable/slidable.
What component should I use?
This is the Bottom sheet component. Check out its specs:
http://www.google.com/design/spec/components/bottom-sheets.html#bottom-sheets-specs
There are third libraries for the bottom sheet if you don't want to make it your self.

Why can't I size android components at will?

Okay, so I'm really trying to do a lab for a class thing and I don't get why I can't have a textbox that takes up the width of the phone and a button that takes up the width of the phone on the bottom, but I don't know why that is? Here's a picture of what I have.
I know this is a noob question but it hasn't been addressed yet on the online course I'm taking and I really need an answer because I wanted android development to be as easy as .NET on windows.
Well anyway here is one picture:
Also here is the other picture:
Notice if I try to make one element bigger, it leads to it pushing the other one out of the activity, I want to have one activity with both elements taking up the entire width of the phone.
Does anyone know what I'm doing wrong?
EDIT: I'm using Ubuntu 14.04 not Mac OS X.
Your controls are children of a LinearLayout with android:orientation="horizontal". This means that the parent ViewGroup is aligning them horizontally; you cannot get the children aligned vertically in this configuration.
If you change the attribute to android:orientation="vertical", you will achieve the result you're looking for.
I strongly suggest getting yourself familiar with the default set of layouts available in the Android SDK by reading this official guide.
Edit : Please refer to this answer for placing views at bottom of the screen.
When you use a android:orientation=horizontal orientation in the layout, the views are stacked/placed in a single row. Since both your views have their width set to fill the screen, only the first one is shown/seen.
What you want is the vertical orientation. This places the views in a single column, one below the other. The width set to fill-parent will allow you the view to occupy all available space.
Official documentation on views : Layouts : Android Dev Docs
Understanding Android Layouts : Techtopia
Android Layout Tutorials : Learn-Android

How can I add a button at the end of a listView?

Iwould like to add a button at the end of a listView in the same way as the bing apps do (see picture for example).
I looked for hours in google and in the microsoft documentation but canøt find anything that can give me an idea of how to do this.
Did anyone achieved this?
thanks
If you run that app (Health & Fitness), then run Visual Studio and use Debug > Attach to Process, you can open the DOM Explorer and examine how that UI is implemented.
What you'll see in this case is that it's not using a ListView at all, but rather it's own custom control that's just based on a CSS grid. That is, just because there's a grid-like view doesn't mean it's a ListView. You can always use straight HTML/CSS layout to achieve these sorts of things, which is all that's happening here. As such, it just makes separate div's for those two "More" elements.
Now if you do want to use a ListView, there are a few things you can do. First of all, if you want to render any item in a ListView differently than others, you have to make sure to use a different template. What this means is that you use an item rendering function rather than a declarative template, which then enables you to examine the item data and programmatically decide what kind of rendering to perform.
Second, if you want to have items of different sizes, then you need to use cell spanning. In Windows 8.0/WinJS 1.0 this is a property of the GridLayout. In Windows 8.1/WinJS 2.0 you instead use the CellSpanningLayout.
I have all the details for both rending functions and cell spanning written up in Chapter 7 of my second edition preview of Programming Windows Store Apps with HTML, CSS, and JavaScript, which is a free ebook from Microsoft Press so it doesn't cost you anything. :)

How to stretch and scale a single child in a container(e.g. panel, groupbox) to fit different resolution screen? C#.net

Basically, I have an usercontrol as main container, inside which I have a few groupboxes and buttons. But, my interface controls will not be resized and positioned properly as what I expect in design interface.
I've already tried to change the anchor and dock properties but none of them serve my purpose.
I searched online and found something called viewbox in WPF, I'm wondering if there is something like "viewbox" in visual studio 2010?
Please help!
Try using TableLayoutPanel container and put your controls in it. It is similar to the idea of table in HTML where it is divided to rows and columns each one of them can be set to either a set of pixels or a percentage. Usually if you want to use re-sizable form, usually you should have a control that will give you good results when stretching such as image, multiline textbox etc... In addition, put the dock property to fill to get the stretching you want.
I hope this info was useful for you.

How to make grid view in j2me

I am very new in j2me. I want to design following type layout and components.
Mean I want to arrange my items in gridview. And after clicking on each item I will move to another form.
I am using simple lcdui. Please suggest me how can I do this. Means how can I arrange these items in gridview and what items should I use here buttons or something else.
You may provide me some suitable links.
In J2ME you have two options for UI: Form and Canvas.
Forms are a very simple way to display information without dealing with the graphical side of things, where Canvas is a blank screen and you need to draw the objects and their behaviors.
There is a third way: the guys at Sun has created a framework called (LWUIT which stands for Light Weight UI Toolkit). This toolkit provides the simplicity of Forms and the UI control of Canvas.
Hope i helped.

Resources