Created
November 21, 2015 21:40
-
-
Save codeasashu/32d37c3e740cb2d5bb87 to your computer and use it in GitHub Desktop.
Show whole layout within dialog in android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:layoutDirection="rtl"> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="@string/help_text" | |
android:id="@+id/textView10" /> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="@string/link_to_guide" | |
android:id="@+id/textView11" /> | |
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
Button btn = (Button) findViewById(R.id.button); | |
btn.setOnclickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
openHelpDialog(); | |
} | |
}); | |
private void openHelpDialog(){ | |
AlertDialog.Builder dialog = new AlertDialog.Builder(WireTransfer.this); | |
final LayoutInflater inflater = getLayoutInflater(); | |
final View rootView = inflater.inflate(R.layout.help, null); | |
dialog.setView(rootView); | |
dialog.setTitle(getResources().getString(R.string.help_header)); | |
dialog.setCancelable(false); | |
dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog,int which) { | |
dialog.dismiss(); | |
} | |
}); | |
dialog.show(); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment