0

У меня есть простое меню где я использую selector. Но в этом selector появляется черный задний фон, я уже много всего перепробовал но так и не понял как сделать его прозрачным.

введите сюда описание изображения

Ниже мои стили:

<LinearLayout
                        android:id="@+id/getbonusClick"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@drawable/shape_corner_tot_left"
                        android:orientation="vertical" >

                        <ImageView
                            android:id="@+id/imageView1"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:layout_marginBottom="10dp"
                            android:layout_marginTop="10dp"
                            android:src="@drawable/cart_icon_time" />

                        <TextView
                            android:id="@+id/getBonus"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:layout_marginBottom="5dp"
                            android:layout_marginLeft="5dp"
                            android:layout_marginRight="5dp"
                            android:gravity="center_horizontal"
                            android:maxLines="2"
                            android:text="Получить \n бонусы"
                            android:textColor="#fff" />
                    </LinearLayout>

shape_corner_tot_left

    <item android:top="-2dp" android:right="-2dp" android:left="-1dp" android:bottom="-2dp">
        <shape>
            <stroke
                android:width="1dp"
                android:color="#ababb2" />

            <corners android:bottomRightRadius="0dp"
                 android:bottomLeftRadius="0dip"
                 android:topLeftRadius="10dip"
                 android:topRightRadius="0.1dp"/>
        </shape>
    </item>

</selector>

1 ответ 1

2

Нужно в shape_corner_tot_left во внутрь <shape> добавить <solid android:color="#00000000" />, а лучше <solid android:color="@android:color/transparent" />.
Соответственно фон у LinearLayout станет прозрачным с указанной границей.

1
  • спасибо, работает!
    – nesalexy
    7 июн 2015 в 7:53

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.