How do I remove the border shadow in:
com.mapbox.services.android.geocoder.ui.GeocoderAutoCompleteView
Could you provide your XML for the geocoder? The geocoding widget extends EditText therefore, you should be able to change the styling similar to an edittext. In the demo app the xml for the widget looks like this:
<com.mapbox.services.android.geocoder.ui.GeocoderAutoCompleteView
android:id="#+id/query"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="18dp"
android:layout_marginStart="18dp"
android:layout_marginTop="14dp"
android:background="#android:color/white"
android:elevation="12dp"
android:hint="Search Location"
android:padding="10dp"
android:singleLine="true"
android:textColor="#android:color/black"/>
removing the android:elevation="12dp" removes the "shadow".
on a side note, from the screenshot above, the shadow actually looks pretty good ;)
Related
I am a new beginner in android development and try to give margin SVG google icon from the top inside the button on the search bar.I know its quick fix but I already try margin properties not affected!
XML
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:drawableTop="#drawable/ic_search"
android:textColor="#FFF"
android:background="#3bbdfa"/>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button1"
android:layout_alignParentLeft="true"
android:ems="13"
android:textColor="#CCC"
android:hint="Search..."
android:background="#null"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp" />
output
see search-bar here
can anyone have the solution? any help is appreciated.
You can use a ImageView instead a Button as explained in this answer,
Center a drawable in a Button with background and no text
I recently started android development and I am struggling a bit.
I read different articles and tutorials on creating drawables etc.
Current Situation
I have created the following buttons:
Using the following code:
<android.support.v7.widget.AppCompatButton
android:id="#+id/login_btn_facebook"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:drawableStart="#drawable/ic_btn_login_facebook"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="Continue with Facebook"
android:textColor="#fff"
app:backgroundTint="#3b5998"/>
<android.support.v7.widget.AppCompatButton
android:id="#+id/login_btn_google"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:drawableStart="#drawable/ic_btn_login_google"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="Continue with Google"
app:backgroundTint="#ffffff" />
Now I actually just need a minor change:
I do not want to have the elevation. I want the buttons to be "flat", and only show the shadow effect when clicked.
Is there a simple way to do this?
Thank you already!
UPDATE:
I need to target API Level 19 as a minimum SDK version.
You have two alternatives to do that:
By adding an XML attribute to your XML Button:
Try this: android:stateListAnimator="#null"
By adding another XML attribute, if the previous alternative has not worked:
Add this style="?android:attr/borderlessButtonStyle" to your XML Button according this.
Let me know if it doesn't work!
Add the following attributes in your layout XML to remove shadows:
android:elevation="0dp"
android:translationZ="0dp"
This will make your layout look like:
<android.support.v7.widget.AppCompatButton
android:id="#+id/login_btn_facebook"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:drawableStart="#drawable/ic_btn_login_facebook"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:elevation="0dp"
android:translationZ="0dp"
android:text="Continue with Facebook"
android:textColor="#fff"
app:backgroundTint="#3b5998"/>
<android.support.v7.widget.AppCompatButton
android:id="#+id/login_btn_google"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:drawableStart="#drawable/ic_btn_login_google"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:elevation="0dp"
android:translationZ="0dp"
android:text="Continue with Google"
app:backgroundTint="#ffffff" />
Read here for more information.
I need to create a sign-in screen like this, am using Android studio.
Screen design.
How do I do this?
The lock and user icon is available here: http://www.fileconvoy.com/dfl.php?id=g36a32a9fc3a1ae3a99959004714c5d27f473d16f6
This is as far as I've created. I need to know how to give the colors as in the picture. I'm trying it, but it isn't working as expected. Also I need the background color not to merge with the EditText.
<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"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".Login"
android:id="#+id/">
<RelativeLayout
android:layout_width="500dp"
android:layout_height="300dp"
android:layout_marginTop="210dp"
android:layout_marginBottom="110dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/nameET"
android:hint="Username"
android:textColorHint="#000000"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="#+id/passwordET"
android:hint="Password"
android:textColorHint="#000000"
android:layout_below="#+id/nameET"
android:layout_alignLeft="#+id/nameET"
android:layout_alignStart="#+id/nameET"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LOGIN >"
android:id="#+id/button2"
android:layout_below="#+id/passwordET"
android:layout_alignLeft="#+id/passwordET"
android:layout_alignStart="#+id/passwordET"
android:layout_alignRight="#+id/passwordET"
android:layout_alignEnd="#+id/passwordET"
android:textColor="#android:color/white"
android:background="#android:color/holo_blue_dark"
android:ellipsize="end" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot Password"
android:id="#+id/textView3"
android:layout_below="#+id/button2"
android:layout_centerHorizontal="true"
android:textStyle="italic" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:maxWidth="35dp"
android:maxHeight="36dp"
android:id="#+id/imageView4"
android:src="#drawable/useri"
android:background="#ff4066ff"
android:layout_toLeftOf="#id/nameET"
android:layout_marginTop="220dp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:maxWidth="35dp"
android:maxHeight="36dp"
android:id="#+id/imageView3"
android:src="#drawable/locki"
android:background="#ff4066ff"
android:layout_toLeftOf="#id/passwordET"
android:layout_marginTop="260dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="EGO >"
android:id="#+id/egoTV"
android:layout_marginBottom="60dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="15dp"
android:layout_above="#+id/nameET"
android:gravity="center"
android:textSize="40dp"/>
This layout is rather complex and if you create too many views, it might be very inefficient. Here is my take on this. For the "Ego" logo, create a single TextView and set the android:drawableRight to the arrow drawable you wanna use, also if you want some space between the "EGO" text and the arrow drawable, set the android:drawablePadding to the value you prefer. For the container of the 3 form controls, group them in a LinearLayout and create a 9-patch drawable and don't specify the stretchable area for the pointing-upwards arrow because when the drawable stretches, the arrow will stay the same which is what you want, you don't want it to stretch to look ugly, use padding to offset those views the way you want, and set the android:background to the stretchable 9-patch image you created. For the username and password fields, you could use the EditText view and also set the android:drawableLeft to the icons you have, you may also create custom background using the ShapeDrawable in XML. For the login button, it is the simplest to implement, create a button of course, but you need to create a new ShapeDrawable resource and use the radius element as a child of the shape root element to make the rounded corner like that, the arrow in the button you could use the greater sign on your keyboard or create an image using Inkscape which is free, very powerful application you should check out if you haven't yet, and also use the android:drawableRight attribute. Alright, last piece is just a TextView with the attribute android:textStyle set to italic. That is how I would do it, it is lots of work, but it is a little work, but you will end up with a layout that is a little more efficient (you could eliminate the use of ImageView if you followed my suggestion). Hope you find this helpful.
You use these attributes to create a shadow effect android:shadowDx android:shadowDy android:shadowColor android:shadowRadius. Dx and Dy are for the horizontal and vertical offset, positive values offset the shadows to right and down respectively, you could even use negative values in which case the shadows go the opposite directions. The radius attribute is for how blurred you want the shadow to be, and color is self-explanatory, but my favorite colors are #d9d9d9 and #550(or #555500) and, but use the #xxx is more memory efficient if any color components have the same value like #55 55 00, I just use #550.
The best way start from here.
Try to understand how work android UI.
In your project find res folder.
In that folder you can find main_activity.xml file or something like this
You can create your own UI in editor or using XML.
I wanted to make an ImageButton to put in my app, but I need a very specific one.
I wanted to make an ImageButton similar to that of the one in QuickPic. Notice on the left screenshot, the Camera. See how there's an image, with a translucent gray bar at the bottom with text in it? I wanted to make something very similar to that, but with one large textview in the gray bar instead of two small ones. I am completely lost on how to do this in XML so if someone could help me, It'd be greatly appreciated. Thanks!
You mean something like this? :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/ic_launcher" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageButton1"
android:layout_alignLeft="#+id/imageButton1"
android:layout_alignRight="#+id/imageButton1"
android:background="#33000000"
android:text="Image Text" />
</RelativeLayout>
Additionally, you can specify the TextView's gravity and textSize to further match your needs:
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageButton1"
android:layout_alignLeft="#+id/imageButton1"
android:layout_alignRight="#+id/imageButton1"
android:background="#33000000"
android:gravity="center_horizontal"
android:text="Image Text"
android:textSize="8sp" />
I'm making chatting application for my school's assignment.
In my opinion, the default EditText in Android does not looks good. I want to make it looks like the URL box in Android's Chrome:
I have seen this design used in other applications such as Catch Notes (which looks beautiful).
So, is there any built-in option to change the EditText or we must draw it from scratch? Can anyone give link? I tried googling it, but I don't know the correct term
Thanks
you can achieving this by doing edittext background transparent.
so put your image in background of your layout and take a edittext inside this. and make edittext transpernt..
or
try this
<EditText
android:id="#+id/tracknumbertxt"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="#+id/info"
android:background="#drawable/enter_tracking_no"
android:ems="10"
android:hint="Enter Tracking No."
android:paddingLeft="30dp"
android:inputType="text"
android:imeOptions="actionGo"
android:singleLine="true" >
</EditText>
here i have assign padding left..
so as per your design you have to set paddingRight property instead of paddingLeft..
Blindly use below layout style..
You will have your layout ready. Just replace the button backgrounds and your are done.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#android:color/darker_gray"
android:padding="5dip"
android:gravity="center">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:background="#android:color/white"
android:gravity="center"
android:padding="5dip">
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Type URL"
android:layout_weight="1"
android:background="#android:color/transparent"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Refresh"/>
</LinearLayout>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn1"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn2"/>
</LinearLayout>
There is nothing native to the SDK that can make it look like that. (maybe if you restrict use to only a certain version of the OS, then you can use that version's default styling, but isn't really a viable solution)
You will need to create an image to use as a background for the EditText to make it look how you want. The best options for text boxes and things like that are to either use a 9-patch image, or to create a layer-list XML file and describe your design that way. Either way, the file would go in the res/drawable folder in the project and you would set it as the background like so:
<EditText android:id="#+id/et_whatever"
android:layout_width="match_parent"
android:layout_height="wrap_content"
background="#drawable/YOUR_FILE_NAME" />