I'm making an app in Xamarin Android and I want to achieve something like this:
https://github.com/Q42/AndroidScrollingImageView
Basically, it's an infinite scrolling image animation. I'm really new to android development let alone Xamarin so I'm at a loss here. I dont think the Translate animation in XML would work here. I'm thinking of translating 2 ImageViews but I dont know how to do that outside XML.
Is there a library similar to that one for Xamarin? Thanks in advance!
The cool thing about Xamarin.Android is that you can easily reuse existing Java libraries. If you are fine with using the AndroidScrollingImageView library instead of rolling out your own implemenetation, here's what you should do:
Clone or download the project to your own computer and build the library.
As a result, you'll get a JAR file that contains the AndroidScrollingImageView control.
Create a new binding project and import the JAR file.
Xamarin.Android wraps the library with C# wrappers so you can invoke Java code from C#.
Now you can use the control in your AXML layouts and call the methods in code.
It's worth reading the binding article to understand how this works. There's also a good binding library example here, where James Montemagno does exactly what you want to do. You might want to study it to see how the binding works in real life.
Related
I wanted to create my own tool for android where i will change xml and that should reflect android ui side by side likewise what android studio and eclipse does.
Can someone tell me what android studio and eclipse uses to render ui from xml as shown in screenshot.
First off: it is not really clear what you want to achieve so I think I should ask some questions first.
- Do you want to create an add-on for an existing IDE?
- Do you want to create an Android Application?
- Do you want to create an IDE similar to Android Studio/ Eclipse?
Answer: If you want to create your own IDE then you need to implement the parsers and preview using 2D drawing. The tools AndroidStudio or Eclipse use to display the XML Views are part of the IDE. As far as I know there is no tool that will display your XML preview as they do. Follow the next instructions in order to implement that part.
But regardless of the answer to any of the questions above, here are some directions.
Since you need to know what kind of content you're using, you should start with an xml parser. How to do that can be found here.
Next step would be to actually draw the Views hierarchy somewhere. For that you need a basic 2D drawing knowledge, and you can start here
Access the resources for different platform and draw them to your window, using processed xml information and Android specific images. You can access the Android specific resources (images) for different platform, through the AOSP here
I hope i managed to point out some directions.
This is a complex thing to do:
One and only solution , Making the compiler for XML, If there are openSource XML parser for java Use them.
If there are not any I am afraid you have to make your own.
unity can do it for you its funny but you can do it with unity you can make android native views like button and ... in as objects in unity and load xml for adding views in right place,its so hard but possible and intresting
As a total Android development beginner, I might be asking a stupid question here, but I thought I'd go for it anyway, since I have no clue about what to do.
I want to have a carousel kind of menu on my MainActivity for the app I'm trying to develop. I found this project after some searching : http://www.codeproject.com/Articles/146145/Android-3D-Carousel
It's exactly the kind of carousel I want to put in my app, but I'm not sure whether I should import parts of the project containing the carousel (which is a demo of it, available to download) so I can use the same type of carousel in the MainActivity of my own app, or if it's a totally wrong way of thinking.
I think I've also figured that Android libraries are .jar files, and this carousel is a project, not a .jar, so I don't know if there is a way to get this kind of component inside my app.
I tried some dirty copying and adapting from one project into another, but I'm so new with even the basic structure of an Android app that I couldn't make anything out of it.
Any help or guidelines would be greatly appreciated.
I'm planning to make a menu out of this kind of component, and couldn't find anything else closer to what I'm trying to do, for Android.
EDIT : I'm working on Eclipse
Stick the visual language of Android, Holo. Pushing clunky GUI that looks out of place is the last thing this platform needs.
You may mark a project as a library when you create it. You can then import it to another project with Project Properties > Android > Add Library. This point answers you question the most, I guess.
I strongly suggest understanding basic widgets and classes first. Don't go onto the deep waters. If you want flashy slidy things, take a look at Fragment and FragmentPagerAdapterclasses. Plenty more examples that are free, to begin with. By using support library v4 and Android Sherlockbar you should get a better feel of the platform while keeping it up to day date and backward compatible.
Download the project, then go File->Import->Android->Existing Code into Workspace and you will have that project in workspace.
If you want to add only activity then create your own one, File->New->Other->Android->Android Activity and then copy the code and check method setContentView() if it have the layout you need. If you have MainActivity activity with layout called activity_main (which is default) then just check if you have setContentView(R.layout.activity_main);.
Is there a handy-dandy equivalent to org.apache.commons.beanutils.PropertyUtils on Android?
I can't seem to use bean utils in my android app due to some dependencies on PropertyDescriptor,and IndexedPropertyDescriptor. So I'm wondering if there are any alternatives?
Basically all I want to do is use a method name as a string "someMethod" and feed that into setMethod(anObject, "someMethod", value), much like PropertyUtils does; but without having to resort to the nasties of reflection...
Or are my hands tied and I need to use Reflection?
There is bridge library which works on Android: android-java-air-bridge.jar. Just include into project path and use all apache beanutils features in your Android project as you could use in ordinary java application. Moreover, there are lot of other classes which moved to this Android supporting library. Look at the list.
There is a possibilty to use libraries or write own code depending on the PropertyUtils. But it sure isn't dandy. You can get the general idea about what has to be done in this thread.
There are apparently some projects who have successfully solved the issue, so you can study thier solution. Take a look at Drawingpad-base and libgdx. You can find PropertyUtils in the package com.madrobot.beans in the first project and com.badlogic.gdx.beans in the second.
I was using DroidDraw, working through the tutorials. Looking at the resulting XML and the Java code to tie them together, I was thinking that I could build a program to automate that process, so I started noodling something together. But before I go off and totally remake the wheel, I was wondering if something like this hasn't already been made before?
I'm thinking of something that takes the layout XML from DroidDraw, and outputs a Java application that works, and is ready for you to add your own code.
It seems pretty basic, has it been done and I've just not spotted it? I've tried Google searches, but I don't see anything similar.
The built-in UI editor that comes with Eclipse used to be pretty crappy - however, it's now getting better and better. Rev 11, which is coming out soon will a lot of new and useful features also.
Give it a try - I think you'll find this is the best tool.
The resulting XML file you can take from DroidDraw requires no Java code.. you simply setContentView(R.layout.name) and that's it!
Just use IntelliJ or Eclipse to set up a skeleton project for you, and import the XML you created via DroidDraw.
There is App Inventor. I have not tried it myself but it sounds pretty much like what you want.
As far as I know it is a very visual approach to develop an application.
i'm following the suggestion in this post: Drawing a gameboard like checkers in Android
basically, the suggestion in the other thread is that the snake demo in the android SDK has a custom view that display a grid of images suitable for a tile based game, such as snake or checkers, and to base the done on that.
if i just wanted to use this code, how would i do so? i'm using the eclipse IDE with the android toolkit installed.
If you really wanted to you could link the source code to be used in your project via symlinks. This is probably the quickest way to include code, though you may bring in other stuff that you may not want.
Another way would be to copy the view (+source dependencies) into your src directory on the filesystem then fix any package issues you may have.