Tag: layout

Android: Custom EditText layout with XML

I am trying to customize the look of an EditText but I am failing to do so… I would like to have the textfield in rounded borders with a graphic icon to the left (so the icon would be inside the borders too, next to the edittext). Could somebody please explain me how I could […]

Android: How to size buttons?

I’m using several buttons in my app, but both layout_width/height “wrap_content” and “fill_parent” looks weird. The former being to small and the latter too large – both looks weird, and the former is not easy to hit with your finger. How should I size buttons? Is it typical to define their sizes in dip? Or […]

how to move 20dip margin left from center?

i want to move a seekbar 20dip margin left from center. android:progressDrawable=”@drawable/progress_vertical” android:thumb=”@drawable/seek_thumb” android:layout_height=”80dip” android:layout_width=”20dip” android:layout_marginBottom=”50dip” android:layout_alignParentBottom=”true” android:visibility=”gone” android:layout_centerHorizontal=”true” android:layout_marginLeft=”20dip” /> but the above xml code shows it center only.

How can I add a fragment to a ViewPager? addView crashes my app

I’m using the default Swipe Tab Fragment code that Android starts with when you start a new Android application. I’ve figured out how to modify my data and use the tabs, but I haven’t figured out how to add a simple fragment to what’s already there. I wanted to add a infobar on the top […]

How to share common layout between activities without fragment

Is there any possible way to share layout(part) between activities? For example, in my app, all activities have similar layout, the top part is long operation indicator (a progress bar, hidden when no operation is being executed), the bottom part is for showing errors. Only the middle part is different for all activities. See the […]

Android: Custom Title Bar

I have a custom title bar requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.activities); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); Which works basically fine. The problem is that until the above code is called the default title bar is shown. I don’t want a title bar there at all, in other words before mine shows up no title shall show up. Adding this to the […]

Android Localization problem: Not all items in the layout update properly when switching locales

Here’s the problem: When I have an activity running in the background, and I switch locales, and I switch back to the application, everything updates… EXCEPT checkboxes and radio buttons that have an “android:id” attribute set. If the checkboxes and radio buttons don’t have the “android:id” attribute, then they update OK. Other fields don’t have […]

Restoring view hierarchy from saved state does not restore views added programatically

I am attempting to save and restore a view hierarchy consisting of a table of buttons. The number of table rows and buttons required in the table is not known until runtime, and are added programmatically to an inflated xml layout in my Activity‘s onCreate(Bundle) method. My question is: can the final table be saved […]

GridView and excess space padding

I have a problem with grid view layout on Android. I can’t find solution to eliminate extra space in grid view. I tried a lot of things (numColumns, columnWidth, stretchMode, gravity) and advices (from StackOverflow), but nothing works correctly. I spent almost 8 hours with this problem. Here is a code of grid view: <GridView […]

How to vertically align text in a TextView with Compound Drawable

This question is in a way a continuation of my last question. My problem now is pretty much the same, except that instead of separating the image and text in differend views (namely ImageView and TextView) I learned I can use the attribute android:drawableLeft to set an image “for” my text (the suggestion was pointed […]

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