Created
August 8, 2014 00:06
-
-
Save Kuchinashi/3b816e4c3272ba449c34 to your computer and use it in GitHub Desktop.
画像を重ねて表示する ref: http://qiita.com/kuchinashi_r/items/eca7107914e00262d241
This file contains hidden or 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
Context appContext = getApplicationContext(); | |
ImageView image = new ImageView(appContext); | |
BitmapDrawable newIcon = (BitmapDrawable) getResources().getDrawable(R.drawable.new_icon); | |
newIcon.setGravity(Gravity.LEFT | Gravity.TOP); | |
Drawable[] drawables = { | |
getResources().getDrawable(R.drawable.twitter), | |
newIcon | |
}; | |
LayerDrawable ld = new LayerDrawable(drawables); | |
image.setImageDrawable(ld); | |
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(WC, WC); | |
lp.addRule(RelativeLayout.ALIGN_TOP | RelativeLayout.ALIGN_LEFT); | |
mRootLayout.addView(image, lp); |
This file contains hidden or 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"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |
<item android:id="@+id/twitter"> | |
<bitmap android:src="@drawable/twitter" /> | |
</item> | |
<item | |
android:id="@+id/new_icon" | |
android:left="50dp"> | |
<bitmap | |
android:gravity="top|left" | |
android:src="@drawable/new_icon" > | |
</bitmap> | |
</item> | |
</layer-list> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment