Пытаюсь сделать прозрачным фон LinearLayout
и при этом текст не должен быть прозрачным.
Делаю так:
linearLayout=(LinearLayout)findViewById(R.id.potehki1);
linearLayout.getBackground().setAlpha(100);
однако,у меня фон и текст становятся прозрачными,а нужно только фон.
Разметка:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/potehki1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppTheme.NoActionBar"
android:gravity="center"
android:background="@drawable/food"
android:orientation="horizontal"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/eda"
android:id="@+id/eda_text"
android:textColor="@color/white"
android:textAlignment="center"
android:textSize="40sp"
android:textStyle="bold"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Пример: фон кнопок прозрачный, а текст нет.