Tag: layout

Move snackbar above the bottom bar

i am facing some problems with new bottom bar. I can’t force to move the snackbar above the bottom bar (this is how design guideline told me should be https://www.google.com/design/spec/components/bottom-navigation.html#bottom-navigation-specs). This is my activity_main.xml <?xml version=”1.0″ encoding=”utf-8″?> <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” android:fitsSystemWindows=”true” tools:openDrawer=”start”> <include layout=”@layout/app_bar_main_activity” android:layout_width=”match_parent” android:layout_height=”match_parent” /> <android.support.design.widget.NavigationView android:id=”@+id/nav_view” android:layout_width=”wrap_content” android:layout_height=”match_parent” […]

Which is the best layout in android we can use to design the UI?

I am using Absolute layout for my UI design in android. My doubt is which layout is best for UI design in android and Is it the design is change in any other device. That means i am using HTC Desire to test my application if i installed my app in any other app means […]

What is setContentView(R.layout.main)?

I understand that it has to do with the App layout, but when do I have to use it? I tried to look for a link that explained this method, but I couldn’t find it. Thank you in advance!

Example of custom setDropDownViewResource spinner item

I would like to display two values in an drop down view of my spinner. Currently, it only has a city name, but I would also like to add a small distance field to it. MyCity<MyCityDistance> dataAdapter; dataAdapter = new MyCity(this, R.layout.mycityrow, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); I have all the code for custom data adapter, exapanding my […]

Evenly spaced button in Layout

I’m trying to make 4 buttons, evenly spaced in a portrait view on Android. The space should scale up and down depending on the screen size, with an even amount of space between each button and the borders. I tried using linear layout, weight and layout gravity but it seems that I cannot center the […]

ImageButton does not display a particular drawable

This is rather a funny problem I have ever come across, I have a table layout with 9 image buttons, 3 per row. Every ImageButton has a different image associated with it. I have set the background of the image button to transparent (#00000000). Now here is where the funny stuff happens, One of the […]

Get position of imageview on layout android

Please help me i want to get position of imageview on a layout.

Adding spinner to ActionBar (not Navigation

I have added a spinner to my ActionBar using the second option from the answer here . How to I add a spinner adapter to the spinner? I tried using a Spinner object as Google describes here but get a null Spinner object. Anybody know how to do this? I don’t want the spinner to […]

Having trouble animating listview layout

I want the items in the listview to slide in one at a time from left to right. I have the following in res/anim/slide_right.xml <?xml version=”1.0″ encoding=”utf-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android” android:interpolator=”@android:anim/accelerate_interpolator”> <translate android:fromXDelta=”100%p” android:toXDelta=”0″ android:duration=”150″ /> </set> And in my onCreate method in my ListActivity I have: LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(this, R.anim.slide_right); mList.setLayoutAnimation(controller); When I run […]

Relativelayout or LinearLayout in ios iphone development?

I want to add a subview in the top of my view, I have to recalculate the origin y value for all of other views and re-position them to leave space for the new added view. It is very boring, as I know android have relativelayout or linearlayout can help automatically do that. How to […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.