简体   繁体   English

如何在布局中设置ImageView,其中某些部分处于相同布局并在布局外部休息

[英]How to set a ImageView in a layout of which some portion is in same layout and rest outside the layout

I want to place the imageview in a layout so that it some portion is visible in same layout and rest should be visible outside it and over other layout. 我想将imageview放在一个布局中,这样它的某些部分在同一个布局中可见,其余部分应该在它外部和其他布局上可见。

activity main 活动主要

<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
sothree:umanoFadeColor="@android:color/transparent"
sothree:umanoPanelHeight="0dp"
sothree:umanoShadowHeight="0dp">

<LinearLayout
android:layout_width="match_parent"
android:background="#c4fff8"
android:layout_height="match_parent">

</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#ffd8b1"
android:orientation="vertical">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:background="@drawable/edittext_layout"
android:layout_height="250dp">

</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/cat1"
android:layout_marginRight="46dp"
android:layout_marginEnd="46dp"
android:layout_marginBottom="-20dp"
android:id="@+id/imageView6"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>

</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

edittext layout 编辑文本布局

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<stroke android:color="#050505"
android:width="1dp"></stroke>
<solid android:color="#80a7a7a7"/>
</shape>

In this app, i want to pull down the layout like the notification pulldown and there will be a image in the layout which will be half visible in the main screen layout, or we can say that its is over the main layout and rest will be in its parent layout. 在这个应用程序中,我想下拉布局,如通知下拉,布局中将有一个图像,在主屏幕布局中将是一半可见,或者我们可以说它是在主要布局上,其余将是在其父布局中。 How can i set image like this, guyz help me out. 我如何设置这样的图像,guyz帮助我。

Thank You In Advance 先感谢您

Importing the Library 导入库

dependencies {
repositories {
mavenCentral()
}
compile 'com.sothree.slidinguppanel:library:3.3.1'
}

The dependency has been taken from the Github, https://github.com/umano/AndroidSlidingUpPanel 依赖性来自Github, https://github.com/umano/AndroidSlidingUpPanel

screenshot is here I want layout arrangement like this but with this dependency ,framelayout will not work. 截图在这里我想要这样的布局安排,但有了这种依赖,framelayout将无法正常工作。

You cannot actually place a View on 2 layouts. 您实际上无法在2个布局上放置视图。 If you just want to the imageView to look as if it is above two layouts you can very well use FrameLayout where you can have the imageview positioned over those layouts. 如果您只是希望imageView看起来好像它位于两个布局之上,那么您可以很好地使用FrameLayout,您可以将imageview放在这些布局上。

But there is no way you can have a view with 2 parent layouts. 但是你无法拥有2个父布局的视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM