Why is my fab button having another color below or around its edges? - floating-action-button

Please view image
I've called a backroundtint in xml and set its color to orange but I noticed that it has another underlying color blue how do I make the color go away and what is the reason for this ?
`<com.google.android.material.floatingactionbutton.FloatingActionButton
` android:id="#+id/contact_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:backgroundTint="#color/brand_yellow"
android:clickable="true"
android:focusable="true"
app:srcCompat="#drawable/ic_call_24"
app:tint="#color/white" />``
type here
I've tried changing the background tint="#EFB627" to just background="EFB627" and this gives me a blue defaulted color . However the the defaulted color blue has no underlying color I noticed. Can some one help me properly set a color for my fab button in xml.

Related

ConstraintLayout fails to properly size or locate ImageView

Sorry I had to remove the Image due to copyright issues
My XML below is trying to place the email icon left justified, as it is. But the size ignores my 3% height specification. I can change the XML in many ways, but no matter what it wants to make the image 60 pixels wide, which is the size it is appearing on the screen and the size of the actual png. All of the scaleType choices just change the image within the 60x60 space on the screen. I really need it to be 3% of the screen height, which in this case, on the emulator is 3% of 480 pixels.
The image with the large email icon is with the constraintDimension line in the XML.
The image with the tiny email image is with that line removed. Note that it is not left justified and that it is partially cropped.
The below and left constraints are both guidelines.
<ImageView
android:id="#+id/email_icon"
app:layout_constraintTop_toBottomOf="#+id/editing_top"
app:layout_constraintHeight_percent="0.03"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="#+id/left_indent"
android:layout_width="wrap_content"
app:layout_constraintDimensionRatio="1:1"
android:src="#drawable/icon_mail"
android:contentDescription="#drawable/icon_mail"
/>[![Unhappy screenshot][1]][1]
You state that the height of the image should be 3% of the height of the layout (app:layout_constraintHeight_percent="0.03"), but you also state that the dimension ration should be 1:1 (app:layout_constraintDimensionRatio="1:1"). These are in conflict.
Remove app:layout_constraintDimensionRatio="1:1" and the height of the ImageView will go to 3% of the screen height and the width will adjust accordingly.
Please see the last note. I believe that app:layout_constraintHeight_percent="0.03" for ImageViews is buggy, maybe only if the icon width is greater than the number of pixels it should be reduced to, maybe just older devices.

alloy appcelerator textfield font color not visible in android version 5

alloy accelerator textfield text font color is not visible.I have tried to change background color and color of the textfield but it still showing that error.
In tiapp.xml add custom theme.
You can refer here
<resources>
<style name="Theme.NoActionBar" parent="#style/Theme.AppCompat.Light"> </style>
</resources>

Why does my LinearLayout with weights leave a pixel space at the bottom for some dimension combinations?

I'm building a UI with LinearLayout where I specify relative sizes using layout_weight. I am seeing an issue where certain combinations of weights will result in a tiny space at the bottom of the screen. I was under the impression that it would scale each child view such that they completely fill the parent LinearLayout - is that not true? How can I use the proportions I want yet prevent a space from showing at the bottom?
This happens for all screen sizes that I've tried in the Android Studio layout tool.
These (undesired) weights result in screen being completely filled:
0.15, 0.75, 0.05
These (desired) weights result in the tiny space at the bottom: 0.15, 0.75, 0.1
Here's my XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#22FF22"
tools:context="...">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.15"
android:textSize="31dp"
android:gravity="center"
android:background="#color/blue90"
android:text="HEADER" />
<ListView
android:id="#+id/listview_workout_selection"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.75">
</ListView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#color/blue90"
android:layout_weight="0.05"></FrameLayout>
</LinearLayout>
It appears to solely be an Android Studio glitch (which I suspect is due to the way it handles float values for weights), i.e. it won't be replicated on real devices. If it's bugging you, just multiply each weight by 100.
The fix was to multiply the desired weights by 10:
1.5, 7.5, 1
Must be some rounding issue caused by small fractional weights.

Positioning Android views on top of a bitmap

I have an ImageView with a bitmap drawable. There are different versions of the bitmap for each device density (hdpi, xhdpi, xxhdpi etc).
I want to position a TextView on top of the ImageView, and relative to the ImageView's position. e.g. 30px from the right, 50px from the top. The TextView needs to always be displayed in a certain part of the image, so its position will be different for each version of the image created for different screen densities.
Positioning with pixels seems to work. I'm able to create different XML layout files with pixel values for the different versions of the image (hdpi, xhdpi, etc). However, I'm not able to specify px units in dimen.xml
Is positioning with pixels the correct method here? Will positioning with pixels relative to the image work across different devices?
I would do it like this. Place a RelativeLayout above your ImageView and set its color to `#66cccccc. And put a TextView in it.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="#drawable/yourImage" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="25dp"
android:background="#66cccccc">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:text="Test Description" />
</RelativeLayout>
</RelativeLayout>

Strange padding on right side of the screen when trying to align ImageView to right

I set the ImageView's layout_gravity to "right" and tried to statically assign 0px padding to all four edges, but I still get the strange, about 10px "padding" to right side of screen. This problem occurs only in landscape orientation. In vertical orientation, the image scales correctly and no padding is happening.
The XML file looks like:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:padding="0px"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<SurfaceView
android:id="#+id/surfaceview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
/>
<ImageView
android:id="#+id/img1"
android:src="#drawable/testimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
/>
</FrameLayout>
Image size is 720x405 and my devices screen is 800x480.

Resources