I've got some problems. with Costraint Layout and Toolbar. I upload some images to explain better what happens. I can't do nothing. If I add a new button It doesn't show it. I don't know if it is a normal situation, but if you have a solution, please, help me.
Thanks in advance
enter image description here
change your android api target to 25 in your gradle file
Change your ConstraintLayout to RelativeLayout and then add below code and see what happens:
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
Related
It looks like FloatingActionButton is not working ether on Android 4.0 and Lollipop. As you can see on image below, on Android Lollipopo shadow is missing and on Android 4.1.1 it's square :/
Anyone faced this issue?
Library version:
compile 'com.android.support:design:22.2.0'
Code:
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/abc_ic_clear_mtrl_alpha"/>
Thanks to #harism comment, simply setting app:borderWidth="0dp" resolve both issues.
Note: don't forget to add xmlns:app="http://schemas.android.com/apk/res-auto" to your root layout.
If the FAB still appears as square after setting borderWidth to 0dp, make sure that you aren't setting android:background in your XML or calling setBackgroundColor in code.
You should use android:backgroundTint (XML) or setSupportBackgroundTintList (code)
#Raghunandan, I have same problem on Lollipop also.
Finally I find that the root cause is a drawable named "fab_background" in my drawable folder.
The drawable is previously used for my own fab implementation.
Now I can see round fab after I rename this drawable.
Setting
app:borderWidth="0dp"
works. But if you are getting rendering issues in Android studio and have the Renderer set to Android M or 22, set it to 21
Seems to be a bug. A developer said "Fixed internally. Will be out soon.".
I want my ToggleButton to like like this .
But with this code , it always shows me the older toggle button.
Am running the code in Emulator with API 21 only, Am I missing something here. My code snippet is
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Found a solution.
Using Android support library. Code snippet is..
<android.support.v7.widget.SwitchCompat
android:id="#+id/id_useridview_switch"
android:layout_marginTop="24dp"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:theme="#style/colortoggle"
/>
Thanks Selvin, got a clue from ur and on what to search
In this code you just set the width and height of your toggle button!
for Android L toggle button you should use support libraries to achieve that!
google something like these:
android L Toggle button support libraries
Also search in Github.com
Use Switch instead of toggle button you will get what u need. No need for external libraries
I'm looking at implementing a cardview which has a button with the ripple effect.
I'm talking about something like this :
https://lh5.ggpht.com/uTRdkJMNyy3KasauJsyGTTRHn5EZBtmA3-BVHCaHWiqBIF_XQmJg_MuE8OdisvefdEk=h900-rw)
I'm trying to implement the download/share button as present on those cards.
Should I be using an ImageButton or something else?
Also, how can I extend the same support for pre-lollipop devices?
UPDATE:
This is the code I'm using right now. It gives me an image button but I'n not able to get touch/ripple effects. The android:foreground property works for cardView and gives the ripple effect, but not for ImageButton.
<ImageButton
android:id="#+id/ib_open_map"
android:background="#drawable/ic_directions_grey600_36dp"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
I think this can be interesting for you.
You will have to import or link the library to be able to use it.
Here is the link to the library :
Link to the library
It is easy to use and it is based on imageView.
Hope it helps you :) Let me know
EDIT
Editing my link for your update :)
Take a look at this : MaterialRipple
i want to make view like this with a button at the bottom. how can i do it? i am new to material design. I tried RecyclerView but i don't know whats that button.
you have to use FloatingActionButton try this.
http://developer.android.com/samples/FloatingActionButtonBasic/index.html
Visit https://github.com/vinc3m1/RoundedImageView/
this library can help you.
When you add library to your project write your xml file like that:
<com.makeramen.roundedimageview.RoundedImageView
android:id="#+id/imageViewID"
android:layout_width="40dp"
android:layout_height="40dp"/>
I have Layout xml file and when i edit it
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/image1"
android:text="llllllllllllllllllll"
android:textColor="#android:color/black" />
But it change like,
its happens when i edit xml file.and after closing xml file and i need to re-open and re-open.is there any solution ?
i already restart my eclipse but can't solve issue.And restart eclipse is not working.is
there any solution for that ?
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421
It is a problem with Eclipse editor which I also face often when the change is done by dragging and dropping in Graphical Layout or so. The solution I follow is to close the xml and reopen again.
This problem happens when you edit your relative layout xml file. To avoid this you can escape this component or close xml file then reopen it.
It's a bug of Eclipse
you can find here is a bug report
Also facing same problem. Sometimes need to restart eclipse also.