Monday, 15 August 2011

xml - Android - Add a button outside LinearLayout -



xml - Android - Add a button outside LinearLayout -

how can add together button outside linearlayout?

i need on bottom. tried myself in few ways, adds same button in each row! i'd appreciate help, give thanks you!

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="5dp" > <checkbox android:id="@+id/checkbox_alarm_active" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:padding="5dp" /> <view android:id="@+id/view1" android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginright="10dp" android:background="#cccccc" android:paddingright="10dp" /> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:paddingbottom="5dp" android:paddingtop="5dp" > <textview android:id="@+id/textview_alarm_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textview_alarm_days" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" /> </linearlayout> </linearlayout>

note editors: saw other similar questions, problem bit different me, don't work.

if want @ exact bottomview of layout, this

<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" tools:context=".mainactivity" > <linearlayout android:id="@+id/linearlayot" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="5dp" > <checkbox android:id="@+id/checkbox_alarm_active" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:padding="5dp" /> <view android:id="@+id/view1" android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginright="10dp" android:background="#cccccc" android:paddingright="10dp" /> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:paddingbottom="5dp" android:paddingtop="5dp" > <textview android:id="@+id/textview_alarm_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textview_alarm_days" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" /> </linearlayout> </linearlayout> <button android:id="@+id/buttontoadd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/linearlayot" android:layout_centerhorizontal="true" android:text="button" /> </relativelayout>

but if want @ extreme bottom view parent's bottom alter this.. (change id="@+id/buttontoadd")

<button android:id="@+id/buttontoadd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:text="button" />

maintain position..let me know if helps....

edit: alter this

<linearlayout android:id="@+id/linearlayot" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="5dp" >

to

<linearlayout android:id="@+id/linearlayot" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="5dp" >

android xml android-layout button android-linearlayout

No comments:

Post a Comment