How to create a very dynamic and animated UI in android? - android

I need to make an android app that has a very dynamic ui.
For example imagine we have an activity with only one button inside that in center. Then when someone clicks the button. The button converts to edittext. When user enters some text, the editText converts to textview. And then under the textview, two new buttons automatically Appear. This proccess will go on untill user create a binary-tree like structure. I want this kind of UIs.
I Hope you Undrestand My Problem.
My question is, how can i achieve this kind of UIs?
Can you give any suggestion?

It depends on what the requirements are, are we talking about simple animations like fading out and fading in, maybe some pulsation and then edit text appearance. It depends because it might be enough to use existing tools like using the ObjectAnimator or even xml or you will have to do some fancy stuff as in writing animation code that meets your particular requirements. Apart from that a factor is what versions of Android are you trying to support JellyBean and above or Lollipop and above.

Related

Is there any Android equivalent of iOS UIAccessibilityTraits?

In my Android app I have a custom layout that is being used as a button - it consists of some TextViews and an ImageView, additionally it has some gradient background.
I'm aligning my app now to conform to the Accessibility rules. In order to do so, I would need to convert this layout into a button, so that TalkBack can correctly indicate the action, that this whole layout is clickable and serves like a button.
I know that on iOS there is a possibility to set the UIAccessibilityTraits to treat such view as a button - this kind of solution would save me a huge amount of work in terms of migration.
Is there any similar solution on Android for that? What approach should I follow in order to make this layout recognized correctly by TalkBack?
No, there's no concept of accessibility traits on Android - but you can still get a good accessibility experience without needing to specifically convert your layout into a Button.
Generally, it's most important that TalkBack (or whatever accessibility service is being used - remember, it's not just TalkBack) is able to detect that the widget is clickable and to be able to read a coherent description of what it does. The additional information that it's a button, specifically, isn't super useful, especially because there are so many different kinds of UI elements that it's often a very ambiguous question whether something even is a button.
You can test this by selecting it in TalkBack and confirming that it reads the content description properly, says something along the lines of "Double tap to activate," and performs the correct action when you double tap.
If it's not correct, make sure the content description, clickable flag, and click action are set correctly on the widget's AccessibilityNodeInfo.

Android dialog : Is there a way to make background android UI clickable while dialog is displayed?

Currently, I am using Libgdx for making app with lots of animation. I am trying to use android Dialog for showing paragraph with html tags through Interface. While, I can change dim color of background UI back to normal with following code.
paragraphDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
Is there anything I can do to make background UI work? (Button click, textview focus etc)
And, I have tried GlyphLayout of Libgdx for paragraph. It frequently crashes & also doesn't support html tags. I am using dialogs, as it is pretty easy to use xml layout easily with dialogs. If there are any other options, Please suggest.
Thanks,
your dialog is blocking the entire screen, doesn't matter if the edges/background are somewhat transparent or not 100% alpha, it is still the view that is currently on top. therefor, you can't click on it directly.
i think the best way to achieve your goal is with a fragment. not a dialog.

draw multiple texts on button for android,inner-shadow

I need a way to draw multiple texts for a button in android..
I would like to simply just extend the default android button with the possibility to have an aditional text that should be overlapped by another text to create sort of a very "intense" inner-shadow effect.
The idea as mentioned is to simply extend the default button and override the onDraw-function and then draw a new text at the same position as the "default-text" for the button.. the problem is that I have no idea about how Im supposed to get the location of the "default-text" for the button..
Any ideas?
You don't have to use multiple views to create this effect. I wrote a blog post awhile back about using EmbossMaskFilter to apply this effect to a TextView. Button is just a glorified TextView, so you can use the same approach to modify its display text through a simple subclass:
http://wiresareobsolete.com/wordpress/2012/04/textview-inner-shadows/
One thing to keep in mind is that this filter is not yet supported by hardware acceleration, so you may need to draw this view on a software layer if the rest of your app takes advantage of acceleration on newer devices (if you don't know whether or not it is, by default it probably is).

need guidance on how to create a questionaire for android

I have a task to create 10 questions where a user should be able to input the answer by using a touch keypad. The user should be able to cycle through questions by pressing a button called "N" Once the the user answers all of the questions a total score out of 10 would be displayed.
Im not asking for an answer but how to approach such a task.
So far ive created a keypad consisting of numbers and i can get 1 question to work and display whether the user entered correct or incorrect information but trying to get more then 1 question to work is messing up.
I had a thought and know that i can create 10 seperate activities for 10 questions but thats slightly crazy.
Can someone give me guidance on how to approach such as task
note im pretty new to android.
Thank You
All views have a visibility attribute (android:visibility); what would look nice is every time the user presses next is to simply hide the old view and make the next one show up (Can even add a fading transition to make it look fun as well)
In XML you can set them all to android:visibility="gone" to begin with, and then in your code, set it to objectName.setVisibility(0) to make it visible, and objectName.setVisibility(8) to hide it completely again.
Here is one approach (not necessarily the best):
*Wherever your question is (hopefully a TextView), get a reference of it in your activity.
*When the user answers a question, output if it was correct or not (A toast?)
*Change the TextView to the next question
You can programmatically add and remove views. You could create an empty view with just a linear layout then add and modify the existing views as you need them.
Are you writing it as a native Android app? A web-app (HTML, Javascript) could do what you're asking, and could be turned into an native app with embedded webkit view.

Which Android control to use?

I'm taking my first steps in Android programming.
My application is to create entries in a database. For this task I have created a new Activity. All is fine - but I don't really like how it looks.
Currently, the emulator shows this:
I'd like to have something similar to the "New Contact" Activity:
Buttons at the bottom of the window, not directly below the other controls (I'll hopefully figure that out myself)
Buttons within a nice "box" like shown in the screenshot (what's the control hosting the buttons here?)
When soft-keyboard is displayed, the buttons should "move up". If there's not enough room, the entire area should be scrollable (I'll try and figure that out myself too)
Sample can be seen here:
Which control hosts the buttons in the above "New contact" screenshot? I'd like to use the same for my buttons.
One way to figure out what an existing activity does is to use hierarchyviewer and examine the activity's contents.
Another way to figure out what a native Android activity does is to look at the source code. In this case, it would appear that the buttons are inside of a horizontal LinearLayout with style="#android:style/ButtonBar" to give the silver sheen. That style, in turn, uses #android:drawable/bottom_bar as its background. That image can be found in your SDK installation -- go to the platform directory of your choice, then data/res/drawable-hdpi and data/res/drawable-mdpi for the two versions.
The contacts layout looks like a ListView sitting on top of some sort of RelativeLayout or LinearLayout housing the buttons. The silver background may simply have been set using android:background on the Layout itself (layouts are views).
I found that the commonsware books are excellent resources for getting started and have good examples for this type of layout.
Hey, this is a little late, and I know you've already got the silver bar you wanted, which is all good, but I've stumbled upon a really good guide on controlling the soft keyboard for best user experience. It covers, among other things, how to make the visible area resize to fit the button bar in the view while typing, which is done by specifying the activity in the manifest file like so:
<activity android:name=".MyActivity" android:windowSoftInputMode="resize" />
I really recommend reading it, it covers a lot more helpful stuff than just that. Hope that helps; I couldn't see that anyone else has answered that particular part of your question.
You can put them in LinearLayout and assign weight of 1 to each of the buttons.
Also if you own dev phone / or want to see UI of the application in emulator - there is a very cool tool call hierarchyviewer
http://developer.android.com/guide/developing/tools/hierarchy-viewer.html
and you can see how UI of app you like has been laydown.

Categories

Resources