Android AlertDialog remove divider between Button.Borderless in ButtonBar -


i pretty following this tutorial , want adapt layout of alertdialog needs. need rid of divider between 2 buttons in buttonbar. changed layout of button this:

<style name="widget.sphinx.button.borderless.small" parent="@android:style/widget.holo.button.borderless.small">         <item name="android:textcolor">@color/button_textcolor</item>         <item name="android:background">@drawable/button</item>         <item name="android:layout_marginleft">10dp</item>         <item name="android:layout_marginright">10dp</item>         <item name="android:layout_marginbottom">10dp</item>         <item name="android:gravity">center</item>         <item name="android:textstyle">normal</item>         <item name="android:dividervertical">@android:color/transparent</item>  </style> 

enter image description here

i tried adapting buttonbar layout well:

<style name="sphinx.buttonbar.alertdialog" parent="@android:style/holo.buttonbar.alertdialog">         <item name="android:background">@android:color/transparent</item>         <item name="android:dividerhorizontal">@null</item>         <item name="android:dividervertical">@null</item> </style> 

i tried setting @null , @android:color/transparent without success. proper way this?

as hussein said, not possible achieve theme styling. created custom alertdialog this:

1) create activity , set it's theme dialog in androidmanifest.xml

   <activity         android:name=".bsadialogactivity"         android:label="@string/title_activity_dialog"         android:theme="@android:style/theme.holo.light.dialog" >     </activity> 

2) create custom layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:weightsum="1">      <textview         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:padding="10dp"         android:textappearance="?android:attr/textappearancelarge"         android:text="edit topic"         android:id="@+id/textview2"         android:textcolor="@color/purple"         android:background="@color/green_light"         android:gravity="center" />      <edittext         android:id="@+id/et_topic"         android:inputtype="text"         android:textcolor="@color/purple"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margintop="16dp"         android:layout_marginleft="5dp"         android:layout_marginright="5dp"         android:layout_marginbottom="5dp"/>      <relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal">          <imagebutton             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margin="10dp"             android:id="@+id/bt_cancel"             android:background="@drawable/button"             android:src="@android:drawable/ic_menu_close_clear_cancel"             android:layout_alignparenttop="true"             android:layout_alignparentleft="true"             android:layout_alignparentstart="true" />          <imagebutton             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margin="10dp"             android:id="@+id/bt_ok"             android:background="@drawable/button"             android:src="@android:drawable/ic_menu_save"             android:layout_alignparenttop="true"             android:layout_alignparentright="true"             android:layout_alignparentend="true" />     </relativelayout> </linearlayout> 

3) start dialog

intent dialogintent = new intent(getactivity(), bsadialogactivity.class); dialogintent.putextra(bsamainactivity.extra_topic, mtopic); getactivity().startactivityforresult(dialogintent, samainactivity.request_dialog); 

4) have @ result

enter image description here

5) handle imagebutton events in dialogactivity

    imagebutton ibsave = (imagebutton) findviewbyid(r.id.bt_ok);     ibsave.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             intent = new intent();             i.putextra(bsamainactivity.extra_topic, ettopic.gettext().tostring());             setresult(result_ok, i);             finish();         }     }); 

6) handle results in mainacitivty

@override protected void onactivityresult(int requestcode, int resultcode, intent data) {     // check request we're responding     if (requestcode == request_dialog) {         if (resultcode == result_ok) {             fragment fragment = getsupportfragmentmanager().findfragmentbytag(bsa_chat_tag);             if (fragment instanceof bsabluetoothchatfragment) {                 ((bsabluetoothchatfragment) fragment).updatetopic(data.getstringextra(extra_topic));             }         }     }     super.onactivityresult(requestcode, resultcode, data); } 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -