Android - change dialog button location -
is possible change location of button on dialog outside of dialog itself? (the red squares buttons):
i know can button :
dialog.getbutton(alertdialog.button_negative)
but couldn't find on manual way change it's location.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:padding="20dp" android:background="#00000000"> <linearlayout android:background="@drawable/border_background" android:layout_gravity="center" android:gravity="center" android:padding="20dp" android:layout_width="match_parent" android:layout_height="200dp" android:orientation="vertical"> <textview android:layout_width="250dp" android:layout_height="wrap_content" android:text="@string/update_app" android:textsize="18sp" android:textcolor="@color/white" android:layout_gravity="center_horizontal" android:gravity="center" /> </linearlayout> <button android:paddingleft="10dp" android:paddingright="10dp" android:layout_margintop="20dp" android:background="#123456" android:layout_width="wrap_content" android:layout_height="35dp" android:layout_gravity="center" android:gravity="center" android:textcolor="#ffffff" android:textsize="14sp" android:onclick="onupdateclicked" android:text="button" />
instead of using default alert dialog, make custom layout layout here. , perform desired action on button.
you can call n show layout without inflating this. edit:1
public void showupdatelayout() { mparentview = (viewgroup) findviewbyid(android.r.id.content); if (mparentview != null) { layoutinflater inflater = (layoutinflater) mcontext.getsystemservice(layout_inflater_service); mupdatelayout = inflater.inflate(r.layout.upadte_layout, mparentview, false); mparentview.addview(mupdatelayout); if (mupdatelayout != null) { mupdatelayout.setvisibility(view.visible); } }
write method in ur public class (or custom aprent activity). , call method when u need alert.
Comments
Post a Comment