Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:tools="http://schemas.android.com/tools"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. tools:context=".MainActivity" >
  6.  
  7. <Button
  8. android:id="@+id/imageButtonHomeSelector"
  9. android:layout_width="wrap_content"
  10. android:layout_height="wrap_content"
  11. android:background="@drawable/icon_home_config"
  12. android:onClick="imageButtonHomeSelector"
  13.  
  14.  
  15. />
  16. <WebView
  17. android:id="@+id/webView1"
  18. android:layout_width="match_parent"
  19. android:layout_height="match_parent"
  20. android:layout_alignParentTop="true"
  21. android:layout_centerHorizontal="true"
  22. android:layout_marginTop="96dp" />
  23.  
  24. </RelativeLayout>
  25.  
  26. public class MainActivity extends Activity {
  27.  
  28. private Button Homebutton, LoginButton, SettingButton;
  29.  
  30.  
  31. public void onCreate(Bundle savedInstanceState) {
  32. final Context context = this;
  33.  
  34. super.onCreate(savedInstanceState);
  35. setContentView(R.layout.webview);
  36.  
  37. Intent intent = new Intent(getApplicationContext(), WebViewActivity.class);
  38.  
  39. startActivity(intent);
  40.  
  41.  
  42. addListenerHomeButton();
  43. // addListenerLoginButton();
  44. // addListenerSettingButton();
  45.  
  46. }
  47.  
  48.  
  49. public void addListenerHomeButton() {
  50.  
  51. Homebutton = (Button) findViewById(R.id.imageButtonHomeSelector);
  52. Homebutton.setFocusable(true);
  53. Homebutton.setFocusableInTouchMode(true);
  54.  
  55. Homebutton.setOnClickListener(new OnClickListener() {
  56.  
  57. @Override
  58. public void onClick(View arg0) {
  59.  
  60. Intent intent = new Intent(getApplicationContext(), WebViewActivity.class);
  61. startActivity(intent);
  62.  
  63. }
  64.  
  65. });
  66.  
  67. }
  68.  
  69. LoginButton = (Button) findViewById(R.id.imageButtonLoginSelector);
  70. // LoginButton.setFocusable(true);
  71. LoginButton.setFocusableInTouchMode(true);
  72.  
  73. LoginButton.setOnClickListener(new OnClickListener() {
  74.  
  75. @Override
  76. public void onClick(View arg0) {
  77.  
  78. Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
  79. startActivity(intent);
  80.  
  81. }
  82.  
  83. });
  84.  
  85. }
  86.  
  87. public void addListenerSettingButton() {
  88.  
  89. SettingButton = (Button) findViewById(R.id.imageButtonSettingSelector);
  90.  
  91. SettingButton.setOnClickListener(new OnClickListener() {
  92.  
  93. @Override
  94. public void onClick(View arg0) {
  95.  
  96. Intent intent = new Intent(getApplicationContext(), SettingActivity.class);
  97. startActivity(intent);
  98.  
  99. }
  100.  
  101. });
  102.  
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement