textview animation in android - android

I have the following requirement.
Initially I want to show the textview half on the screen. This textview when pulled out/clicked should show a complete one.
I just want few hints as to how to get over such animation.

You must use a translation on the X axis animation.
This should give you enough to start working on it:
textview.setX(5000); //TODO: change to (current X + textview.witdh)
textview.animate().translationX(0).setDuration(1000).start();

Related

Zooming text alone inside an android textview

I have a text view with numbers displayed on it. It shows a bill amount value. I would like to have a zoom animation on it, on click. The text view is round shaped and presently zooming zooms the entire circular text view. I used an anim file that uses scaleX and scaleY to zoom. But I just want to zoom the text alone when a user clicks on it. How to zoom text alone inside a textview in android and not the entire textview?
may be you can change textSize property in onClick event of the textView.
void setTextSize (float size) , or this answer may be useful
https://stackoverflow.com/a/20303367/4233036

Unable to scroll in android with appium using python

I tried this piece of code:
scrollObject = dict(direction="down", text="some_text", element=appium_driver_elem.id)
self.driver.execute_script("mobile: scrollTo", scrollObject)
But I am getting an error saying:
"appium_driver_elem does not have attribute like id" or sometimes nosuchelementexception.
What is the simplest way to scroll with appium in android using python? Any full test examples?
self.driver.swipe(470, 1400, 470, x, 400)
self.driver.swipe(start_x, start_y, end_x, end_y, duration)
start_y value represents bottom Y value & end_y value represents top Y value of the screen in your app.
Since to scroll we hold screen at bottom & move up.
value of x depends on how much you wish to scroll in one shot.
Example: To scroll to the bottom, try 300. To scroll little x can be 1200
Still haven't found an answer. So maybe you need to play a little bit rough.
You can use the self.driver.scroll(self,SrcElem,DestElem) function to swipe screen from bottom to top and check the element you seek.
Or You can also try to do
from appium.webdriver.common.touch_action import TouchAction
...
action = TouchAction(self.driver)
action.press(start_element).move_to(end_element).release().perform()
Actually, that's how scroll() function works. Once, I had an issue with self.driver.scroll(), so this can also be a workaround.

how to scale image between 2 views with given coordinates in android

In my application I have a requirement to animate an image (this image view has an arrow set as source).
I am unable to figure this out how I can achieve this.To solve this i got x and y coordinates of second view that is rectangle after getting coordintes i am setting
scaleX() of image view that is purple line but I am not geeting desire out put because it stretches to the whole screen along x-axis
here is the code what i tried is
int x = (int) imageView.getX();
imageView2.setScaleX(x);
here imageview is rectangular box and imageview 2 is the purple line
Why you dont try with scenes? It's exactly what you need.
http://developer.android.com/training/transitions/scenes.html
I think you are getting the correct output when using the above code. Scale is defined against initial dimensions. And you would need to use something like this
dist = box.getX() - circle.getX()
and your scale would be
imageView2.setScale(dist/distInitial)
where distInitial you compute it at creation time using the dist formula.
You might need to change the position because it is scaled around the center of it (i.e. a smaller scale shrink margins to center of image)
You might want to perform this operations using a Canvas. It might be more efficient.

animate changing of text size like android L calculator

In android L calculator app when you try too add more than ten digits
Text size changes with a cool animation. so Text/Font size goes smaller and you can fit more digits
How can I do that ?
[UPDATE]
As shown in this Video
Try these properties. Should be anyone from this.
android:translationX=""
android:translationY=""
android:transformPivotX=""
android:transformPivotY=""
android:scaleX=""
android:scaleY=""
for the Animation use this example :
TextView Animation Size
do it in the Callback onTextChanged which occurs when you Type a char in the View
Hope it helps.
also you can use the same Animation to EditText but use this Example for this :
EditText addTextChangeListener

jump to some line of EditText or TextView with multiline

I have a multi-line EditText/TextView, say 1000 line.
The contents can't be shown on one page, actually there will automatically be a vertical scroll bar.
I want to make a button that can jump to line 500, and the result view start from exactly at line 500.
Anybody know how to achieve this?
You should be able to calculate the scroll in the Y direction using TextView.getLineHeight(), TextView.getLineCount() and TextView.getHeight().From there you can call TextView.scrollTo(0, calculatedY).I'm assuming you always want to have the left side of the view visible. Of course, if your lines were longer than the current View could display, you could similarly calculate an X scroll position also.

Categories

Resources