Skip to content

Instantly share code, notes, and snippets.

@LGLTeam
Last active May 22, 2021 12:57
Show Gist options
  • Save LGLTeam/ee26680e84937efb3136db61fcfa01b6 to your computer and use it in GitHub Desktop.
Save LGLTeam/ee26680e84937efb3136db61fcfa01b6 to your computer and use it in GitHub Desktop.
Android ImageView Banner by RAUNAK MODS
//********** ImageView Banner (By RAUNAK MODS) **********
ImageView banner = new ImageView(this);
RelativeLayout.LayoutParams layoutBannerParams = new RelativeLayout.LayoutParams(-1, -2);
banner.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
layoutBannerParams.addRule(21, -2);//21 -2
layoutBannerParams.setMarginEnd((int) ((271.0f) + 0.5f)); //271
banner.getLayoutParams().height = 150;
banner.getLayoutParams().width = -2;
banner.requestLayout();
banner.setScaleType(ImageView.ScaleType.FIT_XY);
byte[] decode3 = Base64.decode(Banner(), 4);
banner.setImageBitmap(BitmapFactory.decodeByteArray(decode3, 0, decode3.length));
((ViewGroup.MarginLayoutParams) banner.getLayoutParams()).leftMargin = convertDipToPixels(2);
//Add to your view like
yourLinearLayout.addView(banner);
//And add the base64 string in your .cpp
extern "C" {
JNIEXPORT jstring
JNICALL
Java_uk_lgl_modmenu_FloatingModMenuService_Banner(JNIEnv *env, jobject thiz) {
//Use https://www.base64encode.org/ to encode your image to base64
return env->NewStringUTF("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment