How can I make Local view round in Agora? - android

I created customed RoundSurfaceView, and then,
val surfaceView = RtcEngine.CreateRendererView(baseContext) as RoundSurfaceView
and then, I got this error.
java.lang.ClassCastException: io.agora.rtc.video.ViEAndroidGLES20 cannot be cast to
I expect this kind of shape.
How can I make it? I also tried with custom RoundFrameLayout. But it didn't work.

You can use the SurfaceView inside a CardView and add corner radius to it.

Related

Add un text onto an image programmatically using Kotlin

I have a image "myXmlImage" in my .xml file
In the .kt file, I want to paste another "newImage" image as well as a little text "newText".
myXmlImage.setImageDrawable(newImage.drawable)
myXmlImage.imageMatrix = newImage.imageMatrix
So far it has been working very well and the new image is in place.
I'm completely stuck on how to paste the little "newText" into it
Any ideas will be greatly appreciated, thanks in advance.
Perhaps there's more than what you've described here. But if those are really your only specifications, then what you're asking for is really easy.
I'm assuming that your xml file has a root of ConstraintLayout. If it doesn't, then you're going to either want to change it or at least wrap your ImageView inside of a ConstraintLayout.
Use the layout editor to place a TextView inside of your ImageView (NOT AS A CHILD; when I say "inside", I mean spacially inside). If you haven't used the layout editor very much, it might take you a couple of tries to place the TextView inside. Don't just drag it into the ImageView as if it were a child. Drag it and drop it under the ImageView inside of the ConstraintLayout and then use little circles on the sides to attach it to the sides of the ImageView. Don't forget to set the text of the TextView as "".
(I'm not actually sure if this step is necessary because I don't know what the default background of a TextView is, but I do it out of habit.)When you're done placing that TextView inside of the ImageView, go the code of your xml file and use android:background="#00FFFFFF" (or maybe somewhere in your project you have either a transparent background drawable or a transparent #color that you can reference by name).
I'm sure you know the rest. Just give that TextView an Id like newtext and inside of your activity retrieve the view: newText:TextView=findViewById(R.id.newtext). And then set the text: newText.text="new text".

shadow effect in android color cardview

Want this kind of shadow effect with android card view except for white background with cardview property, neither use with the canvas draw mechanism nor 9 patch image mechanism
want to use only drawable shape or cardview properties. TIA
EDIT: There is this github project you can use to get custom shadow for CardView. Just implement it in your project and use this instead of androidx components. Link: https://github.com/nvl2val/CardView/tree/master
2nd EDIT: Also another workaround for this issue. Read this thread: Android change Material elevation shadow color
I don't really get your question but CardView itself has a lot of properties you can play with. Check this documentation for more: https://developer.android.com/reference/androidx/cardview/widget/CardView
Using elevation will give you shadow by default so if you don't want a shadow on objects with a white background you need to set the elevation to 0. Here you can play with
android:elevation = "10dp"
app:cardElevation = "10dp"
and see which one does the job better for you. Also, try adding some padding to your parent layout so that CardView has some space around. All this and maybe more you can find in this answer: https://stackoverflow.com/a/46374054/14759470

How to Add text after End drawable in Materialtextinput Android

I would like to add text like this, is this possible with MaterialLayout & MaterialTextInput ??
It can be done in two ways.
The more complicated way is to extend the MaterialTextInput and override methods.
The simple way is to put the MaterialTextInput in a FrameLayout along with a TextView with a fixed size. Create a same size dummy Drawable (eg: ColorDrawable) and set it as end drawable.
Comment for further information.

How to give any shape to Views?

How to give any shape to Views in android
I want following background to textview.
You can create shapes using xml drawables in Android.
https://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
But the background you want is not straightforward using xml. So I recommend creating background using any image editor and set it as background of the textview.
Another approach would be to create vector drawable for the required shape which is supported from android API 21. Here is a good tutorial to create your your own shapes and images
https://medium.com/#ali.muzaffar/understanding-vectordrawable-pathdata-commands-in-android-d56a6054610e
To customize a View you should create a custom view. Create a new class by extending the View class, implement all public constructors and override the onDraw function. When using in the layout file give the full path of the custom view:
<com.example.ownview.MyDrawView
android:id="#+id/myDrawView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

How to make a long oval shape with custom shadow in Android

I think i mentioned the name of the shape wrong.
I want to make shape like the following image with shadows in Android,
Sample model
So how to make this type of layout in Android .
thanx for the help!!
You should try this one:
https://github.com/Hitomis/CrazyShadow
By drawable you can generate the shape, and by using this library you will be able to add shadow.
Or:
You can use the library itself.

Categories

Resources