2016-07-17 63 views
2

我试图让其中容器主.Iam使图像模糊如何使布局半透明?

this is what i am getting

一个滚动的标签,但我想显示一半模糊,一半彩色

here

在第二个我想要显示模糊背景和另一半的材料设计颜色“没有alpha”

如何设置此 这里是我的容器主代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.example.union.front1.MainActivity" 
    tools:showIn="@layout/activity_main"> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <android.support.v4.view.ViewPager 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/pager" 
      android:background="#060606"> 
      <android.support.v4.view.PagerTitleStrip 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:theme="@style/Base.TextAppearance.AppCompat.Widget.ActionBar.Title" 
       android:id="@+id/title" 
       android:paddingTop="4dp" 
       android:paddingBottom="4dp" 
       android:layout_gravity="top" 
       android:background="#000" 
       style="@style/AppTheme.my" 
       android:layout_marginTop="15dp"/> 
     </android.support.v4.view.ViewPager> 
    </RelativeLayout> 
    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:scaleType="fitXY" 
     android:id="@+id/imageView" 
     android:alpha="0.8" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" /> 

</RelativeLayout> 

这里是我的片段代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context="com.example.union.front1.Album" 
    android:background="#e5060606"> 

    <es.guiguegon.sineview.SineView 
     android:id="@+id/sine_view_album" 
     android:layout_width="match_parent" 
     android:layout_height="80dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     app:sv_sine_alpha="1" 
     app:sv_sine_amplitude="25dp" 
     app:sv_sine_animation_time_millis="2000" 
     app:sv_sine_color="@color/colorPrimaryDark" 
     app:sv_sine_periods_to_show="2" 
     app:sv_sine_phase="1" /> 
</RelativeLayout> 

如何设置一半的布局透明和一半强烈的色彩

回答

0

我是做错误我把我的imageview放置在viewpager下方,这意味着图像视图图层会在视图分页图层上方,所以我将imageview图层放置在viewpager图层上方,这样我就不必设置图像的alpha,并且它会显示图像在背景中。当我在我的片段中使用强烈的颜色时,它将保持强壮,因为我没有使用图像视图的Alpha版本'

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.example.union.front1.MainActivity" 
tools:showIn="@layout/activity_main"> 
<ImageView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:scaleType="fitXY" 
android:id="@+id/imageView" 
android:layout_centerVertical="true" 
android:layout_centerHorizontal="true" />` 
<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<android.support.v4.view.ViewPager 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/pager" 

    android:background="#060606" 
    > 
    <android.support.v4.view.PagerTitleStrip 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:theme="@style/Base.TextAppearance.AppCompat.Widget.ActionBar.Title" 
     android:id="@+id/title" 
     android:paddingTop="4dp" 
     android:paddingBottom="4dp" 
     android:layout_gravity="top" 
     android:background="#000" 
     style="@style/AppTheme.my" 
     android:layout_marginTop="15dp" 


     /> 
</android.support.v4.view.ViewPager> 
</RelativeLayout> 
</RelativeLayout>