An Android layout defines everything the user can see and touch.
402
votes
21answers
292k views
How to get screen dimensions
I created some custom elements and I want to programmatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge) therefore I need to get the screen ...
249
votes
4answers
53k views
what is the difference between match_parent and fill_parent property in android
I'm little confused about two properties match_parent and fill_parent of layout. It seems both are same. I want to know how this properties are different? TIA
220
votes
3answers
54k views
Navigation Drawer (Google+ vs. YouTube)
Does anyone know how to implement a sliding menu like some of the top apps of today?
Other Stack Overflow questions haven't had any answers on how to do this, so I'm trying to gather as much info to ...
213
votes
13answers
160k views
How to hide the title bar for an Activity in XML with existing custom theme
I want to hide the title bar for some of my activities. The problem is that I applied a style to all my activities, therefore I can't simply set the theme to @android:style/Theme.NoTitleBar.
Using ...
206
votes
9answers
95k views
How to align views at the bottom of the screen?
Here's my layout code;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
...
198
votes
7answers
88k views
Android - gravity and layout_gravity
I know we can set the following value to the android:gravity and android:layout_gravity
center
center_vertical
center_horizontal, etc.
But i am confused regarding these both.
what is the ...
134
votes
2answers
24k views
What's “tools:context” in Android layout files?
Starting with a recent new version of ADT, I've noticed this new attribute on the layout XML files, for example:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
...
129
votes
6answers
56k views
What does android:layout_weight mean?
I don't understand how to use this attribute. Can anyone tell me more about it?
98
votes
4answers
46k views
Can I underline text in an android layout?
How can I define underlined text in an Android layout xml file?
91
votes
18answers
69k views
Android: How to create a Dialog without a title?
I'm trying to generate a custom dialog in Android.
I create my Dialog like this:
dialog = new Dialog(this);
dialog.setContentView(R.layout.my_dialog);
Everythings works fine except for the title ...
86
votes
3answers
28k views
LinearLayout not expanding inside a ScrollView
I have a LinearLayout inside a ScrollView that has android:layout_height="fill_parent", but it doesn't expand to the full height of the ScrollView. My layout looks something like:
level layout ...
79
votes
10answers
71k views
converting pixels to dp in android
I have created my application with the height and width given in pixel for a pantech device whose resolution is 480x800.
I need to convert the the height and width for an G1 device. I thought ...
73
votes
3answers
45k views
Android Lint contentDescription warning
I am getting warning as
"[Accessibility] Missing contentDescription attribute on image" for imageview. while using android lint
What does that mean?
68
votes
10answers
78k views
Linear Layout and weight in Android
I always read about this funny weight value in the Android documentations.
Now I want to try it for the first time but it isn't working at all.
As I understand it from the documentations this ...
68
votes
7answers
26k views
How did Google manage to do this? Slide ActionBar in Android application
I really want to implement this (the side navigation) in an app of my own, does anyone know how Google managed to do this?
They seem to have pulled the current window aside and put in a fly-in ...