How to create an arc shaped progress bar in 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 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" />

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 make this bar in android studio [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 don't know how to make this bar in the layout in android studio?
i want the XML code for this part of the activity.
You can use Seekbar to achieve a similar one. Please refer this for more information: https://developer.android.com/reference/android/widget/SeekBar.html
This is a sample xml:
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="26dp"
android:max="100" >
</SeekBar>
Feel free to customize the indicators. Also, this is a good tutorial: http://abhiandroid.com/ui/seekbar

Add overlays to video on 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 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

How to handle click events on a drawable within an TextView? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have the same problem as discussed on Handling click events on a drawable within an EditText, but I use TextView instead of EditText. When I click on the TextView, the method onTouchEvent(MotionEvent event) is called. Is it possible to handle a click only on the icon?
I think the idea is pretty much the same as described here: use the event coordinates and determine if they are within the drawable's bounds. If they are, perform your action. I don't think there are any major differences between TextView and EditText in this respect.
I think that it would be a better idea to use a TextView and an ImageView. Of course, it leads to a more complex layout structure, but I'd prefer two widgets in an XML file rather than too much Java code dealing with the widgets.
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/iv"
android:text="#string/long_text"
android:textSize="22sp" />
<ImageView
android:id="#id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:contentDescription="#string/app_name"
android:src="#drawable/btn_go" />

Categories

Resources