Загрузка ресурса в изменяемое растровое изображение

Это должно отображаться в центре экрана с выравниванием по центру. Если вы хотите выровнять текст, вы можете использовать android: gravity = "right" или android: gravity = "left"

     <RelativeLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/textView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:gravity="center" 
                    android:text="This is some text" />    
    </RelativeLayout>
25
задан Kara 9 December 2013 в 03:50
поделиться

1 ответ

Ваш Instad:

Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image);

Использование:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable = true;

Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image, options);
0
ответ дан 28 November 2019 в 21:27
поделиться
Другие вопросы по тегам:

Похожие вопросы: