Reputation: 727
In my Android app I would put one image with a certain transparency over a background with maximum opacity. To try this, I have tried to create a relative layout, with a background image view (to create the background, with full opacity, alpha = 1), and over this one an other image view, with low opacity value (alpha). And, in the same relative layout, also a text view with some indications.
Very strange! On my Android emulator, all works correctly. But in more than one real device, I see perfectly the background image view and the TextView but the second image view (the one with the image in low opacity) is completely invisible! Why? Thanks, I copy my code under.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1" android:id="@+id/controlImageView">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/controlImageViewBack"
android:focusableInTouchMode="false"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="@drawable/bck_main"
android:alpha="1"
android:layout_weight="1"
android:contentDescription="@string/desc_img_control_background"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/controlImageViewPicture"
android:scaleType="fitStart"
android:src="@drawable/ctrl_bck"
android:focusableInTouchMode="false"
android:paddingTop="10dp"
android:alpha="0.5"
android:paddingBottom="10dp"
android:layout_alignTop="@id/controlImageViewBack"
android:contentDescription="@string/desc_img_control_picture"/>
<TextView android:id="@+id/controlMessageText" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_alignTop="@id/controlImageViewBack"
android:textSize="@dimen/board_text_size"
android:textColor="@color/colorButtonText"
android:textAlignment="center" android:gravity="center"
android:text="@string/mod_control_nomessage"/>
</RelativeLayout>
Upvotes: 2
Views: 221
Reputation: 727
Solved! From logs:
05-01 12:46:12.288 24904-24904/com.mycompany.myapp W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (840x2524, max=2048x2048).
Very strange, but for the first time I have seen that in some graphic element it is impossible to insert too big images.
Upvotes: 1
Reputation: 941
Firstly, weight and layoutOrientation don't have any effects on a Relative Layout !
The Code worked on my Nexus 5X !
What real device do you use ?
Upvotes: 0