java - Android custom dialog dim and buttons -


hello need guys help. need know how make custom dialog in button of layout, whole layout dimt accept custom dialog, , last how let buttons work in xml custom dialog 1 button close dialog , 1 start call intent.

here custom dialog xml

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_marginleft="10dp"     android:layout_marginright="10dp"     android:orientation="vertical"     android:paddingbottom="20dp">      <button         android:id="@+id/maps_call_window_button_exit"         android:layout_width="95dp"         android:layout_height="20dp"         android:background="@color/colorbuttons"         android:drawableleft="@drawable/main_btn_close"         android:drawablepadding="2dip"         android:gravity="center"         android:paddingleft="10dip"         android:paddingright="10dip"         android:text="hoi" />      <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@id/maps_call_window_button_exit"         android:background="@color/color_maps_info_windo"         android:orientation="vertical"         android:paddingbottom="10dp"         android:weightsum="100">          <textview             android:id="@+id/maps_call_title"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:gravity="center"             android:paddingtop="20dp" />          <textview             android:id="@+id/maps_call_cost"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:gravity="center"             android:paddingbottom="20dp"             android:paddingleft="5dp"             android:paddingright="5dp"             android:paddingtop="10dp" />          <button             android:id="@+id/maps_call_button_window"             android:layout_width="match_parent"             android:layout_height="40dp"             android:layout_gravity="center"             android:layout_marginleft="10dp"             android:layout_marginright="10dp"             android:background="@drawable/custom_button"             android:drawableleft="@drawable/main_btn_phone"             android:drawablepadding="2dip"             android:gravity="center"             android:paddingleft="60dip"             android:paddingright="80dip" />      </linearlayout> </relativelayout> 

here layout xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">         <include         android:id="@+id/app_bar"         layout="@layout/app_bar"></include>      <view         android:layout_width="match_parent"         android:layout_height="1dp"         android:background="@color/color_appbar_edge" />      <framelayout         android:layout_width="match_parent"         android:layout_height="match_parent">          <progressbar             style="?android:attr/progressbarstylelarge"             android:id="@+id/loadingbar"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:indeterminate="true"             android:layout_gravity="center" />          <imageview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="center"             android:id="@+id/loadinglogo"             android:src="@drawable/clock_mini"/>             <fragment             android:id="@+id/mapfragment"             android:name="com.google.android.gms.maps.mapfragment"             android:layout_width="match_parent"             android:layout_height="match_parent" />          <relativelayout             android:layout_width="match_parent"             android:layout_height="match_parent"             android:id="@+id/dim_screen">              <include                 android:id="@+id/callwindow"                 layout="@layout/maps_call_window"                 android:layout_width="270dp"                 android:layout_height="wrap_content"                 android:layout_alignparentbottom="true"                 android:layout_centerinparent="true"                 android:paddingbottom="80dp"></include>              <button                 android:id="@+id/maps_call_button"                 android:layout_width="match_parent"                 android:layout_height="40dp"                 android:layout_alignparentbottom="true"                 android:layout_marginbottom="20dp"                 android:layout_marginleft="50dp"                 android:layout_marginright="50dp"                 android:background="@drawable/custom_button"                 android:drawableleft="@drawable/main_btn_phone"                 android:drawablepadding="2dip"                 android:paddingleft="20dip"                 android:paddingright="46dip" />           </relativelayout>     </framelayout> </linearlayout> 

and here java

//is activated on normal screensize         if ((getresources().getconfiguration().screenlayout &                 configuration.screenlayout_size_mask) ==                 configuration.screenlayout_size_normal) {              //find id of imageview in maps xml             final button buttoncallpopup = (button) findviewbyid(r.id.maps_call_button);             button buttoncallexit = (button) findviewbyid(r.id.maps_call_window_button_exit);             final button buttoncall = (button) findviewbyid(r.id.maps_call_button_window);              //find id of textview in maps xml             textview mapscost = (textview) findviewbyid(r.id.maps_call_title);             textview descriptioncall = (textview) findviewbyid(r.id.maps_call_cost);              //get , set text of view             buttoncallpopup.settext(getresources().getstring(r.string.maps_info_call_now));             buttoncallexit.settext(getresources().getstring(r.string.maps_info_call_exit));             buttoncall.settext(getresources().getstring(r.string.maps_info_call_now_phone));             mapscost.settext(getresources().getstring(r.string.maps_info_call_cost_phone));             descriptioncall.settext(getresources().getstring(r.string.maps_info_call_descripion_phone));              //get , set size of tittleview text             buttoncallpopup.settextsize(getresources().getinteger(r.integer.maps_info_call_now_size));             buttoncallexit.settextsize(getresources().getinteger(r.integer.maps_info_call_exit_size));             buttoncall.settextsize(getresources().getinteger(r.integer.maps_info_call_now_size_phone));              //get , set color of tittleview text             buttoncallpopup.settextcolor(getresources().getcolor(r.color.white));             buttoncallexit.settextcolor(getresources().getcolor(r.color.white));             buttoncall.settextcolor(getresources().getcolor(r.color.white));             mapscost.settextcolor(getresources().getcolor(r.color.white));             descriptioncall.settextcolor(getresources().getcolor(r.color.white));              //find id of infowindow relativelayout on maps xml screen             callinfowindow = (relativelayout) findviewbyid(r.id.callwindow);              //set infowindow invisible             callinfowindow.setvisibility(view.invisible);              //when popupbutton pressed             buttoncallpopup.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view v) {                     //set button callpopup invisible                     buttoncallpopup.setvisibility(view.invisible);                      //set infowindow visible                     callinfowindow.setvisibility(view.visible);                   }             }); 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -