Giter Club home page Giter Club logo

Comments (8)

Alexxiaopang avatar Alexxiaopang commented on May 24, 2024

经过测试LinearLayout不会被挤压RelativeLayout就会被挤压,但是我的view必须是是盖在recyclerview上面并且居中的,请问有什么办法么?

from panelswitchhelper.

Alexxiaopang avatar Alexxiaopang commented on May 24, 2024

根布局是LinearLayout 就不会被挤压了,

<com.effective.android.panel.view.PanelSwitchLayout
    android:id="@+id/panel_switch_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:animationSpeed="standard">

    <!-- 内容区域 -->
    <!-- edit_view 指定一个 EditText 用于输入 ,必须项-->
    <!-- empty_view 指定用户点击该 ID 对应的 View 时实现面板或者输入法隐藏,非必须项 -->
    <com.effective.android.panel.view.content.ContentRelativeContainer
        android:id="@+id/content_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:relative_edit_view="@id/edit_text">

根布局是RelativeLayout,就一定会被挤压,但是recyclerview不会被挤压变形


<com.effective.android.panel.view.PanelSwitchLayout
android:id="@+id/panel_switch_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:animationSpeed="standard">

    <!-- 内容区域 -->
    <!-- edit_view 指定一个 EditText 用于输入 ,必须项-->
    <!-- empty_view 指定用户点击该 ID 对应的 View 时实现面板或者输入法隐藏,非必须项 -->
    <com.effective.android.panel.view.content.ContentRelativeContainer
        android:id="@+id/content_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:relative_edit_view="@id/edit_text">

from panelswitchhelper.

YummyLau avatar YummyLau commented on May 24, 2024

contentCanScrollOutside 为true则不会挤压。 你的场景描述得很抽象。礼物是什么布局,贴一下你整体的布局我才能理解你布局是怎么写的。 @Alexxiaopang

from panelswitchhelper.

Alexxiaopang avatar Alexxiaopang commented on May 24, 2024

<com.effective.android.panel.view.PanelSwitchLayout
    android:id="@+id/panel_switch_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:animationSpeed="standard">

    <com.effective.android.panel.view.content.ContentRelativeContainer
        android:id="@+id/content_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:relative_edit_view="@id/edit_text">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_chat"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingBottom="5dp"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            tools:itemCount="100"
            tools:listitem="@layout/item_chat_text" />
        <com.puffer.live.ui.widget.roundview.RoundTextView
            android:id="@+id/tv_badge"
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            android:layout_above="@+id/bottom_action"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="5dp"
            android:drawableRight="@mipmap/chatroom_newmessage_remind"
            android:drawablePadding="5dp"
            android:gravity="center"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:text=""
            android:textColor="@color/colorWhite"
            android:textSize="8sp"
            android:visibility="gone"
            app:rv_backgroundColor="#00B880"
            app:rv_cornerRadius="10dp" />


        <com.puffer.live.ui.tab_match.livedetail.chat.RealNameLinearLayout
            android:id="@+id/bottom_action"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="#ffffff"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:gravity="center_vertical"
            android:minHeight="50dp"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/emotion_btn"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:scaleType="centerInside"
                android:src="@drawable/selector_emotion_btn" />

            <EditText
                android:id="@+id/edit_text"
                android:layout_width="0dp"
                android:layout_height="36dp"
                android:layout_marginRight="10dp"
                android:layout_weight="1"
                android:background="@drawable/linearlayout_background_circle_5_e5e5e5"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:inputType="textMultiLine"
                android:paddingLeft="7dp"
                android:singleLine="false"
                android:textSize="12sp" />


            <com.sugar.sugarlibrary.widget.StateButton
                android:id="@+id/bt_send"
                android:layout_width="54dp"
                android:layout_height="30dp"
                android:layout_marginRight="11dp"
                android:gravity="center"
                android:text="发送"
                android:textColor="#ffffff"
                android:textSize="16sp"
                android:visibility="gone"
                app:normalBackgroundColor="@color/color0077FE"
                app:normalTextColor="@color/colorWhite"
                app:radius_new="4dp" />

            <com.puffer.live.ui.widget.roundview.RoundTextView
                android:id="@+id/tv_send"
                android:layout_width="54dp"
                android:layout_height="30dp"
                android:layout_marginRight="11dp"
                android:gravity="center"
                android:text="发送"
                android:textColor="#ffffff"
                android:textSize="16sp"
                android:visibility="visible"
                app:rv_backgroundColor="@color/color0077FE"
                app:rv_cornerRadius="4dp"
                app:rv_isRippleEnable="true" />

        </com.puffer.live.ui.tab_match.livedetail.chat.RealNameLinearLayout>


    </com.effective.android.panel.view.content.ContentRelativeContainer>

    <com.effective.android.panel.view.PanelContainer
        android:id="@+id/panel_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

<com.effective.android.panel.view.PanelView
android:id="@+id/panel_emotion"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:panel_layout="@layout/panel_emotion_layout"
app:panel_trigger="@id/emotion_btn" />

    </com.effective.android.panel.view.PanelContainer>
</com.effective.android.panel.view.PanelSwitchLayout>


<TextView
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:layout_centerInParent="true"
    android:layout_centerVertical="true"
    android:gravity="center"
    android:text="礼物的视图,也只是一个view,希望被键盘盖住而已,相对于整个布局居中" />

from panelswitchhelper.

Alexxiaopang avatar Alexxiaopang commented on May 24, 2024

这个就是全部的布局,外层贴上来就没了,外层是一个RelativeLayout

想做的效果:键盘顶起来的时候是盖住居中的礼物视图(可看做一个textview),但是我用了两种办法,这个视图都会跟着键盘移动

这个是在viewpage的fragment的,activity就一个 固定高度的 RelativeLayout+tablayout+viewpage

from panelswitchhelper.

YummyLau avatar YummyLau commented on May 24, 2024

输入法的显示必定会引起 window 窗口的更改,这个是系统特性的。你的问题出在:你的礼物写死了居中根布局,而根布局会随着window变化而更改高度。假如你礼物不想被滑动,也是有办法的。假如在window变化前,你的应用界面是1920高度。变化之后是1120.假设输入法是800,你的礼物视图高度是 900,你在页面初始化之后,获取应用界面高度,然后计算你礼物在没有window变化的时候,marginTop的高度(1920-900)/2 =500,然后动态设置这个属性。就不会跟随window变化而变化。

from panelswitchhelper.

Alexxiaopang avatar Alexxiaopang commented on May 24, 2024

可以了,已经解决,因为布局变了,不能用android:layout_centerInParent等属性,我在代码里面动态设置marginTop,已经解决,谢谢!

from panelswitchhelper.

YummyLau avatar YummyLau commented on May 24, 2024

@Alexxiaopang 那就好

from panelswitchhelper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.