Add overlays to video on Android [closed] - android

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm developing an Android application, this application load video file from android gallery that saved on SD Card.
I need to know how can I add overlays to this video
I need to add title and image on this video like brand images
I can not find an example or tutorial describe how to do this operation
Do I have to use decoding to add overlays? , And if yes how can I do that.
Any example about this...

Provided you're playing the video using a VideoView or similar, you can overlay any View (e.g. TextView, ImageView) using a RelativeLayout.
For example, to show a text on the top right corner of the video:
<RelativeLayout
android:id="#+id/playerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<VideoView
android:id="#+id/videoPlayer"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/videoText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="3dp"
android:text="#string/player_text" />
</RelativeLayout>

As #rbarriuso said, ffmpeg4Android is able to meet your requirement. There is also a guide to install both library and demo in both Android Studio and Eclipse. Following, there are also the watermark command which may satisfy you.
Hope it can help

Related

Android: Any Ideas on how to make a Hearthstone/Magicka type of card? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Details:
I was wondering how to create an object in android that has multiple layers of graphical elements. A good example would be a Magicka or Hearthstone card. They have 3 elements: the background of the card, the image of the creature, text describing something + stats.
The idea behind this is to have fewer images that can be put together to create a great amount of cards. I should mention that in my case the background card and the creature are vectors (SVG).
How do you put all of these elements together in one card-thing that can later be displayed&animated?
You can use proper layout.
Most reasonable to me is using RelativeLayout.
You can put all views:
background (can be a separate view or background view param)
image (ImageView)
text (TextView)
For example:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="160dp"
android:layout_height="240dp"
android:background="#color/aaa">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:src="#drawable/cat_filmy_main" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:text="Movie Killer" />
</RelativeLayout>
And the effect is:
Also, consider creating your own view. How to do that can be found here:
https://code.tutsplus.com/tutorials/android-sdk-creating-custom-views--mobile-14548

Is it possible to create a layout like this in Android..? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to design a XML resource layout like traditional blogs as shown in the below image. It should contain an image on the right side and rest of the area (combining left side area of the image and whole area below the image) should be filled with text.
Any ideas?
You are looking for FlowTextView
Here is an snippet
<uk.co.deanwild.flowtextview.FlowTextView
android:id="#+id/ftv"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:src="#drawable/android"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="400dip"
android:padding="10dip"
android:src="#drawable/android2"/>
</uk.co.deanwild.flowtextview.FlowTextView>
and in code
FlowTextView flowTextView = (FlowTextView) findViewById(R.id.ftv);
Spanned html = Html.fromHtml("<html>Your html goes here....");
flowTextView.setText(html);
Add jitpack to your your build.gradle at the end of repositories:
repositories {
// ...
maven { url "https://jitpack.io" }
}
Add the dependency:
compile 'com.github.deano2390:FlowTextView:2.0.5'
You'll want to brush up on creating custom Views then.
A single TextView will not be able to do this for you since its workable space is rectangular.
You can create a custom View that will know how to layout variable width per line text as well as draw the image view where you want it.
I recommend starting with what android.widget.TextView does to draw text and modify it to suit your needs.
Or, you can find a custom View that someone else has already written and componentized that you can use.

How to create an arc shaped progress bar in Android? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to create a progress bar like the following image.
My requirements are:
1. I want to be able to set a progress value to it programmatically.
2. I want to be able to change the colors of the arc - both the background one (grey) and the foreground one (green).
I looked into libraries but found none that do it in this particular shape and style. I am not proficient enough in creating custom drawables to be able to create this by myself. Any help is appreciated!
In addition to the above answer, you can also use CircleProgress which seems to have something that looks exactly like your use case:
Usage:
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="#+id/arc_progress"
android:background="#214193"
android:layout_marginLeft="50dp"
android:layout_width="100dp"
android:layout_height="100dp"
custom:arc_progress="55"
custom:arc_bottom_text="MEMORY"/>
Also, if you check the license on this library (bottom of their README), it seems like it's very favorable to using it however you wish.
You can use SeekArc. It can do everything you need to get that result.
It would look something like this
<com.triggertrap.seekarc.SeekArc
android:id="#+id/seekArc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="30dp"
seekarc:rotation="180"
seekarc:startAngle="30"
seekarc:sweepAngle="300"
seekarc:arcColor="#color/grey"
seekarc:progressColor="#color/green"
seekarc:touchInside="true" />

What is the best way to change the source of an imageview? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have one imageview which consist of one png file. I want to change the source of this imageview according to 4 different events (4 different pngs).
Currently I'm changing the source with imageView.setImageResource, but this has lag and causes lots of Choreographer warnings.
Are there better ways?
You can try this library http://square.github.io/picasso/ to load image
Use a library like Picasso or Glide.
They both have a very easy syntax and will load the image in a seperate thread and so no lag happens on the UI thread.
check out the libraries at
https://github.com/bumptech/glide
https://github.com/square/picasso
there are more image loading libraries but these are probably the easiest to use.
You could have four ImageViews on top of each other and then just change the visibility depending on what you want to show. There would be no lag in terms of loading picture to memory because they are all there already. Just make sure that the pictures aren't too memory intensive
Code:
if (something)
imageview1.setVisibility(View.VISIBLE);
else if (something)
imageview2.setVisibility(View.GONE);
RelativeLayout by default stacks views on top of each other. Setting visibility.gone in linearlayout might also make the views "stack".
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<ImageView
android:id="#+id/pic1"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/pic1"
android:visibility="visible"
android:contentDescription="default picture"/>
<ImageView
android:id="#+id/pic2"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/pic2"
android:visibility="invisible"
android:contentDescription="pic2"/>
<ImageView
android:id="#+id/pic3"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/pic3"
android:visibility="invisible"
android:contentDescription="pic3"/>
<ImageView
android:id="#+id/pic4"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/pic4"
android:visibility="invisible"
android:contentDescription="pic4"/>
</RelativeLayout>
You can have 4 imageViews instead of one, that have already loaded your 4 images, and adjust the visibility of these imageViews related to which image must be visible.
Like this, you won't need to change the source of any imageView during execution (just the visibility) and will get rid of the loading/decoding time.

Justify Text in TextView Android [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do you get textview to be justified ? is it possible to get the solution? I have searched most of the forums but i didn't make it up. please help me out.
UPDATED
We have created a simple class for this. There are currently two methods to achieve what you are looking for. Both require NO WEBVIEW and SUPPORTS SPANNABLES.
LIBRARY: https://github.com/bluejamesbond/TextJustify-Android
SUPPORTS: Android 2.0 to 5.X
SETUP
// Please visit Github for latest setup instructions.
SCREENSHOT
Android doesn't support text justification, sorry. You can use android:gravity attribute to align text to left or right or center etc, but you can't really justify it. The only option I guess is to use a WebView to show text and then use CSS to get the text justified.
<RelativeLayout android:id="#+id/RelativeLayout01"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<TextView android:id="#+id/TextView2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="I'm TextView- Left" android:layout_alignParentLeft="true">
</TextView>
<TextView android:id="#+id/TextView1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="I'm TextView- Right" android:layout_alignParentRight="true">
</TextView>
</RelativeLayout>
ScreenShot:
Hope this helps. If you have any difficulties write back.- Thanks

Categories

Resources