I need xml styles for tab on or off state,whenever i click the button,display rounded rectangle on button.How can i make new style for given image.please give some tips for me
how to create styles for rounded rectangle like this image
For that add rounded cornered images as a background to tab:
tab = tabs.newTabSpec("tab_Busquedas");
tab.setContent(new Intent().setClassName("com.grapp", "com.grapp.homes").putExtras(bundle));
tab.setIndicator(null,null);
tabs.addTab(tab);
//here you set the image with rounded corners over the tab.
tabs.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.mytab_roundedcorners);
This solution is posted at: How to achieve rounded tabs in Android 2.1 +
You can make use of the themes feature for the same.
http://developer.android.com/guide/topics/ui/themes.html
If you make use of this feature, maintainability will also be easy.
Regards,
SSuman185
Related
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
I need to add a scrollable android TextView, which will show alot of text.
I want to achieve this kind of effect:
But I found no way of doing so.
Is there any good way of doing it?
Thank you!
try below properties to TextView
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="32dp" //To change the gradient overlay height
The most convient way of doing this is creating a drawable. You can either make your own image in the image editing software of your choice or create a GradientDrawable. Make sure the colors go from white to transparent. Then place this drawable on top of the textview near the bottom.
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.
How can I set the border radius of logo image in the ToolbarAndroid component?
I know it can't be styled by style property.
You need to do two steps:
create custom Toolbar layout with - it' only example - ImageView and TextView
make an ImageView coreners rounded. Check: How to make an ImageView with rounded corners?
replace original one with this. Check: Creating a custom toolbar in android
Hope help
I want to create icons as something like this image or something like on the homepage of quickr. If I use custom gridview for this as in this (of course in my case I need the text below the image ), then adding listeners to that would be difficult I guess. Should I use buttons for that with the image and text below that provided the background is transparent? If so which layout I need to use? Or is there any icon view facility in android like other views such as button and imageviews, so that we can modify as per our requirement.
You should use button for that.
<Button
android:id="#+id/btnIconName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="#drawable/iconimage"
android:text="IconTitle" />
For showing icon you should use android:drawableTop and for iocnTitle use android:text
Property.
I hope my answer is helpful to you.
GridView will be the best option to do this and why dont you ask your graphics guy to add text with image.