Making GUI in a ModPE script is a lot harder then usual because it is in Java and not JavaScript, you should be able to find some tutorials in the forums or YouTube
var activity=com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
try {
useWindow = new android.widget.PopupWindow();
var useLayout = new android.widget.RelativeLayout(activity);
var useButton = new android.widget.Button(activity);
useButton.setText("Just a name");
useButton.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(viewarg) {
//ModPE functions and other stuffs here
}}))
useLayout.addView(useButton);
useWindow.setContentView(useLayout);
useWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); useWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); useWindow.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT)); useWindow.showAtLocation(activity.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
}catch(problem){
print("Bruh your codes has a problem ("+problem+"), go fix it ya newb");
}}}));
I made this template a while back for personal use, just use common sense and you'll figure it out after looking at it a lot. Until then, just use this template
Hello guys, i want to display a small image in my screen ( middle right side )
there the example
then when i click it, it will run some function like setPlayerHealth etc..
anyone can give me the code ?
Making GUI in a ModPE script is a lot harder then usual because it is in Java and not JavaScript, you should be able to find some tutorials in the forums or YouTube
var activity=com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
activity.runOnUiThread(new java.lang.Runnable({ run: function() {
try {
useWindow = new android.widget.PopupWindow();
var useLayout = new android.widget.RelativeLayout(activity);
var useButton = new android.widget.Button(activity);
useButton.setText("Just a name");
useButton.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(viewarg) {
//ModPE functions and other stuffs here
}}))
useLayout.addView(useButton);
useWindow.setContentView(useLayout);
useWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); useWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); useWindow.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT)); useWindow.showAtLocation(activity.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
}catch(problem){
print("Bruh your codes has a problem ("+problem+"), go fix it ya newb");
}}}));
I made this template a while back for personal use, just use common sense and you'll figure it out after looking at it a lot. Until then, just use this template
I have nothing to say...
its button not image view