please tell me, it is necessary to do this: At the root RelativeLayout, I changed the background, android:background="@drawable/fragment2" but this background needs to be placed over the entire markup, i.e. to the foreground, I understand that I set the background, but You can somehow place the background on top of all the markup.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:background="@drawable/fragment2"> <LinearLayout android:id="@+id/lldinamik" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:paddingBottom="0dp" android:paddingLeft="1dp" android:paddingRight="1dp" android:paddingTop="1dp" android:theme="@style/AppTheme.NoActionBar"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="horizontal"> <View android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="2" /> <ImageView android:id="@+id/b1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/belarus" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="2" /> <ImageView android:id="@+id/b2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/russia" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="2" /> <ImageView android:id="@+id/b3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/japan" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="2" /> <ImageView android:id="@+id/b4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/litva" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="2" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="horizontal"> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="2" /> <ImageView android:id="@+id/b5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/england" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="1" /> <ImageView android:id="@+id/b6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/finland" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="1" /> <ImageView android:id="@+id/b7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:scaleType="centerInside" android:src="@drawable/france" /> <View android:layout_width="0dp" android:layout_height="10dp" android:layout_weight="2" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="60dp" android:layout_gravity="right|bottom" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_stop" android:clickable="true" android:layout_gravity="center" android:layout_marginRight="5dp" android:layout_marginBottom="2dp" android:src="@drawable/stop_button" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:id="@+id/button_play" android:clickable="true" android:layout_marginRight="5dp" android:src="@drawable/play_button" /> <SeekBar android:id="@+id/sbar" android:layout_width="300dp" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:max="100" android:progress="0"/> <TextView android:id="@+id/textPlayer" android:textColor="@color/white" android:layout_width="70dp" android:layout_height="wrap_content" android:layout_margin="10dp" android:layout_gravity="center" android:text=" " android:textSize="20sp" /> </LinearLayout> </LinearLayout> </RelativeLayout> 
  • I do not quite understand how it should look, why do you need all these elements if they are covered with a background? - newakkoff
  • @ newakkoff I’ll just show you a transparent background with training on the program, but I’m going to hide it and don’t show it again - upward
  • github.com/amlcurran/ShowcaseView here try the library. - newakkoff
  • @newakkoff, to my regret, I have not found sensible advice on its use .. and my knowledge is not enough yet - upward
  • Of course your business, but I would recommend to download the project by reference and look at the example, there is nothing complicated. - newakkoff

2 answers 2

FrameLayout has an android:foreground attribute in which you can specify what you need:

 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:foreground="@drawable/fragment2"> <!-- ваша разметка --> </FrameLayout> 
  • tell me, and if you need to show this android: foreground = "@ drawable / fragment2" only once and do not show it again, I do this: prefs = getContext (). getSharedPreferences ("com.example.potehki.potehki.fragments", getCon Text (). MODE_PRIVATE); if (prefs.getBoolean ("firstrun", true)) {prefs.edit (). putBoolean ("firstrun", false) .commit (); frameLayout.setForeground (null); } however, no result - upward

Try to use alpha channel for elements that need to remove the background. Make the background transparent for them. android: background = "@ android: color / transparent". Or set a specific alpha value in such #ARGB or such format #AARRGGBB. Where A or AA is the value of alpha channel.