Wednesday, November 27, 2013

DISPLAY FIXED LAYOUT AT THE BOTTOM IN ANDROID USING VS2012

XAMARIN – DISPLAY FIXED LAYOUT AT THE BOTTOM IN ANDROID

 
 
 
 
 
 
Rate This

In some design scenarios, where we would require a fixed layout at the bottom of the screen. The fixed layout may contain a set of controls. In this post, we would see how do we do that.
Here is a sample layout with ListView.
As you see in above image, the last control before the Fixed Layout, should have the above properties with values.
Now, the Linear Layout would become fixed at the bottom, once you apply the style of ButtonBar.
Now the Button inside it, is the content of the fixed layout.
Hope this quick post helps, thanks for reading.
The following is the xml for your reference.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="utf-8"?>
 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
 
<ListView
 
android:layout_width="fill_parent"
 
android:layout_height="0dp"
 
android:layout_weight="1"
 
android:id="@+id/listView1" />
 
<LinearLayout
 
style="@android:style/ButtonBar"
 
android:orientation="horizontal"
 
android:layout_width="fill_parent"
 
android:layout_height="wrap_content">
 
<Button
 
android:text="Done"
 
android:layout_width="fill_parent"
 
android:layout_height="fill_parent"
 
android:id="@+id/button1" />
 
</LinearLayout>
 
</LinearLayout>

No comments:

Post a Comment