2015-02-27 3 views
0

Я хочу, чтобы моя относительная компоновка была прозрачной. У меня есть относительный макет, который содержит linearlayout и два изображения. Цвет, который я использую сейчас, - # 878787, но как я могу настроить прозрачность всего макета. Возможно ли это в Android или нет. У кого-нибудь есть проблема такого типа. Большое спасибоКак установить прозрачный цвет относительной компоновки

<RelativeLayout 
     android:id="@+id/linearLayout4" 
     android:layout_width="match_parent" 
     android:layout_height="?android:attr/actionBarSize" 
     android:layout_alignParentBottom="true" 
     android:background="#878787" 
     android:orientation="horizontal" 
     android:weightSum="100" > 

     <ImageView 
      android:id="@+id/previousButton" 
      android:layout_width="50dp" 
      android:layout_height="wrap_content" 
      android:layout_marginEnd="-7dp" 
      android:layout_marginLeft="-7dp" 
      android:layout_marginRight="-7dp" 
      android:layout_marginStart="-7dp" 
      android:contentDescription="@string/autoskola_imageView" 
      android:soundEffectsEnabled="false" 
      android:src="@drawable/ikona_lijevo" /> 

     <ImageView 
      android:id="@+id/nextButton" 
      android:layout_width="50dp" 
      android:layout_height="wrap_content" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginEnd="-7dp" 
      android:layout_marginLeft="-7dp" 
      android:layout_marginRight="-7dp" 
      android:layout_marginStart="-7dp" 
      android:contentDescription="@string/autoskola_imageView" 
      android:soundEffectsEnabled="false" 
      android:src="@drawable/ikona_desno" /> 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_centerHorizontal="true" > 

      <ImageView 
       android:id="@+id/povecaloButtonPitanja" 
       android:layout_width="100dp" 
       android:layout_height="match_parent" 
       android:layout_marginLeft="5dp" 
       android:layout_marginStart="5dp" 
       android:contentDescription="@string/autoskola_imageView" 
       android:soundEffectsEnabled="false" /> 

      <ImageView 
       android:id="@+id/informacijeButton" 
       android:layout_width="100dp" 
       android:layout_height="match_parent" 
       android:layout_marginEnd="5dp" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginStart="5dp" 
       android:contentDescription="@string/autoskola_imageView" 
       android:soundEffectsEnabled="false" 
       android:src="@drawable/gumb_informacije" /> 

      <ImageView 
       android:id="@+id/odgovoriButton" 
       android:layout_width="100dp" 
       android:layout_height="match_parent" 
       android:layout_marginLeft="5dp" 
       android:layout_marginStart="5dp" 
       android:contentDescription="@string/autoskola_imageView" 
       android:soundEffectsEnabled="false" 
       android:src="@drawable/gumb_odgovori" /> 
     </LinearLayout> 
    </RelativeLayout> 
+0

Что именно вы подразумеваете под прозрачной планировкой? – IntegralOfTan

+0

Вам нужен полупрозрачный фон? – Fahim

+0

Да, не полностью прозрачный, просто полупрозрачный. Вы знаете, как это исправить –

ответ

1

Просто установите цвет на «# 00000000». Последние 6 шестнадцатеричных цифр не имеют значения. первые два набора альфа в 0. Или используйте встроенный прозрачный цвет. Я думаю, что даже @null работает.

1

Использование android:alpha="0" // Назначение вашего значения альфа от 0 до 1. 0 для полной прозрачности.

<RelativeLayout 
      android:id="@+id/linearLayout4" 
      android:layout_width="match_parent" 
      android:layout_height="?android:attr/actionBarSize" 
      android:layout_alignParentBottom="true" 
      android:background="#878787" 
      android:alpha="0" 
      android:orientation="horizontal" 
      android:weightSum="100" > 

      <ImageView 
       android:id="@+id/previousButton" 
       android:layout_width="50dp" 
       android:layout_height="wrap_content" 
       android:layout_marginEnd="-7dp" 
       android:layout_marginLeft="-7dp" 
       android:layout_marginRight="-7dp" 
       android:layout_marginStart="-7dp" 
       android:contentDescription="@string/autoskola_imageView" 
       android:soundEffectsEnabled="false" 
       android:src="@drawable/ikona_lijevo" /> 

      <ImageView 
       android:id="@+id/nextButton" 
       android:layout_width="50dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentEnd="true" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentTop="true" 
       android:layout_marginEnd="-7dp" 
       android:layout_marginLeft="-7dp" 
       android:layout_marginRight="-7dp" 
       android:layout_marginStart="-7dp" 
       android:contentDescription="@string/autoskola_imageView" 
       android:soundEffectsEnabled="false" 
       android:src="@drawable/ikona_desno" /> 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_centerHorizontal="true" > 

       <ImageView 
        android:id="@+id/povecaloButtonPitanja" 
        android:layout_width="100dp" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="5dp" 
        android:layout_marginStart="5dp" 
        android:contentDescription="@string/autoskola_imageView" 
        android:soundEffectsEnabled="false" /> 

       <ImageView 
        android:id="@+id/informacijeButton" 
        android:layout_width="100dp" 
        android:layout_height="match_parent" 
        android:layout_marginEnd="5dp" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" 
        android:layout_marginStart="5dp" 
        android:contentDescription="@string/autoskola_imageView" 
        android:soundEffectsEnabled="false" 
        android:src="@drawable/gumb_informacije" /> 

       <ImageView 
        android:id="@+id/odgovoriButton" 
        android:layout_width="100dp" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="5dp" 
        android:layout_marginStart="5dp" 
        android:contentDescription="@string/autoskola_imageView" 
        android:soundEffectsEnabled="false" 
        android:src="@drawable/gumb_odgovori" /> 
      </LinearLayout> 
     </RelativeLayout> 
0

Вот по этой ссылке, может помочь вам понять прозрачность% в шестигранном цвете, первые две цифр procent прозрачности и другие ваш желаемый цвет. - >>https://stackoverflow.com/a/17239853/2971619

Смежные вопросы