android - Render Dialog elements with Material Design Style -


i'm creating dialog fragment layout uses checkboxes. however, i'm never able render them material design in pre-lollipop devices. however, i'm able done in regular activity. have when dealing dialogfragments?

these parts of dialogfragment code:

 @override     public dialog oncreatedialog(bundle savedinstancestate) {         dialog dialog = super.oncreatedialog(savedinstancestate);          setstyle(dialogfragment.style_normal, r.style.theme_appcompat_dialog);          window window = dialog.getwindow();         window.requestfeature(window.feature_no_title);         window.getattributes().windowanimations = r.style.share_multiplayer_animation;         return dialog;     }   @override     public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {         view view = inflater.inflate(r.layout.share_multiplayer_scorecard, container, false);         butterknife.bind(this, view);          viewgroup sharecontainer = butterknife.findbyid(view, r.id.container);         list<multiplayerround> multiplayerroundlist = mround.getmultiplayerroundlist();         (int = 0; < multiplayerroundlist.size(); i++) {             multiplayerround mpround = multiplayerroundlist.get(i);             view rowview = inflater.inflate(r.layout.multiplayer_share_row, sharecontainer, false);              textview nametv = butterknife.findbyid(rowview, r.id.et_name);             nametv.settext(mpround.getname());              checkbox checkbox = butterknife.findbyid(rowview, r.id.cb_send_scorecard);              final edittext emailet = butterknife.findbyid(rowview, r.id.et_email);             emailet.addtextchangedlistener(new checkboxcontrollertextwatcher(checkbox));             emailet.setonfocuschangelistener(new view.onfocuschangelistener() {                 @override                 public void onfocuschange(view v, boolean hasfocus) {                     emailet.setselection(emailet.gettext().length());                 }             });              string email = getemail(mpround);             emailet.settext(email);              updatecheckboxstate(email, checkbox);              sharecontainer.addview(rowview);             mplayerviews[i] = rowview;             rowview.settag(mpround);         }         return view;     } 

this dialog layout

<?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:orientation="vertical"     android:paddingtop="@dimen/activity_vertical_margin">      <com.devspark.robototextview.widget.robototextview         android:id="@+id/tv_title"         style="@style/materialdialog.title"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:gravity="center_vertical"         android:text="@string/round.multiplayer.share.scorecard"/>      <linearlayout         android:id="@+id/container"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_marginleft="@dimen/activity_horizontal_margin"         android:layout_marginright="@dimen/activity_horizontal_margin"         android:orientation="vertical"/>      <linearlayout         style="@style/materialdialog.buttonbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_marginbottom="16dp">          <com.devspark.robototextview.widget.robotobutton             android:id="@+id/btn_dismiss"             style="@style/materialdialog.button"             android:layout_width="wrap_content"             android:text="@string/share_dismiss"/>          <com.devspark.robototextview.widget.robotobutton             android:id="@+id/btn_send"             style="@style/materialdialog.button"             android:layout_width="wrap_content"             android:text="@string/action_send"/>     </linearlayout> </linearlayout> 

thank you.

as of revision 23 of appcompat, can use appcompatdialogfragment create material design dialogfragment compatible android 2.1.


Comments

Popular posts from this blog

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

python - Pygame screen.blit not working -

c# - Web API response xml language -