last day (14 days later) » 

1:27 PM
0
Q: How to move bar under buttons in android java

Frank LindstromCurrently I'm developing video app and I want to animate red bar when VIDEOS, PHOTOS, CAMERA ROLL button are tapped(For example Animate red bar to under Photos button when Photos button is clicked). Can anyone please help me?

 
eli
Take a look at Toolbar.
 
sorry but could you tell me more exactly?
why do i have to use toolbar, i think what i have to do is only animate red bar when buttons are tapped.
 
eli
@FrankLindstrom You haven't given us any code of what you've tried so far. I'm just giving you a hint in the right direction, as Google has a lot of samples on how to use Toolbar.
 
sorry but i didn't know how to google it. lol. but if toolbar solve that problem I'll google right now.
 
eli
You could of course just have 3 Buttons, and use #setOnClickListener, but I'd use a Toolbar, as it has far more features, and you won't have to reinvent the wheel.
 
1:27 PM
hi, could you please tell me solution when i use button and #setOnClickListener as I don't think we need to use toolbar for this?
 
eli
Sure, I'll give you a sample if the answer is opened up.
 
eli
Hello
I'll post some code on pastebin in 10-15 minutes. Might have to do this without buttons, but instead use TextView, as it might be complicated to add bottom border or e.g. red underline on black text when using a Button.
 
Ok, thank you very much.
looking forward to hearing from you soon.
 
eli
1:40 PM
Are you using Android Studio?
 
eli
Okay, this is the layout: pastebin.com/f6eNF0bf
And this is the logic: pastebin.com/dGB5N4Kv
Note, you'll have to resize everything yourself, work around with the positioning and what-not. This just shows how to do it with OnClickListener.
 
ok, thx
let me check
btw it will be great if you send me full android project.
 
eli
You can also create shapes and add those to the layout. But for e.g. a bottom border, you'll have to use layers. I think this is the minimum code for what you seek. I still urge you to reconsider and use Toolbar. Or ActionBar, if your minSdk target is below API 21.
Yeah, sure, give me a minute.
 
1:56 PM
ok, thx
btw do you know snapchat bottom buttons animation effect?
we can't use toolbar for that i think.
hi
 
eli
Nope, I don't spend much time on SnapChat. Or, actually... I don't use any time at all.
Where do you want me to upload the project?
 
sendspace.com
you only need to upload file and send link to me.
 
eli
minSdk is 21, so make sure you use emulator that supports that version (or greater).
 
ok, np. btw can you please give this answer to my question on stackoverflow so that i can give you reputation?
 
eli
2:11 PM
You'll have to elaborate on your question. E.g. add that you want to achieve what you're looking for with a Button or a TextView, using ClickListeners. It'll be added to the queue of questions to be reopened (it'll be officially closed in 4-5 days if you don't edit the question/add new content).
 
OK, thanks for your help.
i wish i'll have future paid job for you. :)
can you please share your skype id for future job?
 
eli
I don't use Skype. You can use my email instead: maagenator@gmail.com
 
ok, thx
i'll reach you soon.
do you use freelancing sites like upwork or freelancer?
 
eli
No, I just finished studying Computer Science at Denmarks Technical University, so I'm looking for a job.
Or I didn't finish, I quit studying.
 
ok
Hope I'll get a job for you soon.
 
2:49 PM
Hi
I checked your code.
as i checked, you display/hide bars when buttons are tapped.
but is there any better way to implement it?
for example when button is tapped, move red bar to that button position
 
eli
It would be quite heavy programmatically. I wouldn't recommend it.
This is why I suggest that you use Toolbar instead.
 
but i think placing 3 red bar views is not good solution.
i think we need to place only one red bar view and move when buttons are tapped.
sorry if i'm wrong
 
3:25 PM
Hi
 
eli
3:42 PM
You can do that, sure. Moving it will require you to set the position of the View. Note, the views are actually full Views (not just a red line), their hieght is just set to 2dp so it looks like a line.
But you have the elements needed to do this yourself (or try to figure it out). You can use the switchUnderline-method, and just edit it to reposition a View.
 

last day (14 days later) »