代码:
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:backgroundTint="@android:color/transparent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:backgroundTint="@android:color/transparent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
<com.github.florent37.arclayout.ArcLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:background="@android:color/transparent"
app:arc_cropDirection="cropOutside"
app:arc_height="30dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
</com.github.florent37.arclayout.ArcLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/vkiscrollview"
android:layout_width="match_parent"
android:layout_height="604dp"
android:background="@color/darkblue"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:visibility="gone"
android:backgroundTint="@color/transparent">
CONTENT....
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
我要删除图像中看到的背景(在弧形布局为灰色backgroundcolor下)。 每个地方的背景色都不透明。 我想在项目或弧形ETC中使用弧形布局。我写了上面的所有代码。.另外,如何绘制像弧形布局这样的xml形状?
它不会尝试所有内容。请帮助我
先谢谢了。
答案 0 :(得分:0)
您确定要设置为arclayout的背景色是透明的吗?这些是颜色透明度的代码。将值放在颜色值的前面。示例:
FF FF2D00
100%-FF 95%-F2 90%— E6 85%— D9 80%— CC 75%—高炉 70%— B3 65%— A6 60%— 99 55%— 8摄氏度 50%— 80 45%— 73 40%— 66 35%— 59 30%— 4D 25%— 40 20%— 33 15%— 26 10%— 1A 5%— 0天 0%— 00
答案 1 :(得分:0)
android:background="#00000000"
尝试一下对我有用。
答案 2 :(得分:0)
尝试将ArcLayout
移到AppBarLayout
之外,如下所示:
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
app:elevation="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:backgroundTint="@android:color/transparent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:backgroundTint="@android:color/transparent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
<com.github.florent37.arclayout.ArcLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:background="@android:color/transparent"
app:arc_cropDirection="cropOutside"
app:arc_height="30dp">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
</com.github.florent37.arclayout.ArcLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/vkiscrollview"
android:layout_width="match_parent"
android:layout_height="604dp"
android:background="@color/darkblue">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:visibility="gone"
android:backgroundTint="@color/transparent">
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>