java - Android 视图 asbolute 超出父级
问题描述
我的问题是有没有办法让他的父母看到?我正在尝试这样做,但我不知道该怎么做
我尝试使用 RelativeLayout 和 ConstraintLayout 但我仍然无法工作......
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/card_promotion_image"
android:layout_width="128dp"
android:layout_height="110dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="-20dp"
android:src="@drawable/im_carrying_letters" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
解决方案
如果您想将其水平移出其超级视图,请在代码中尝试修改translationX属性。如果要垂直移动它,请尝试修改translationZ属性。并且不要忘记将超级视图的clipToPadding和clipChildren属性设置为false,以便您移动的视图可以显示在其超级视图的边框之外
推荐阅读
- java - 单击结帐按钮时总计的问题
- reactjs - 我可以在 REST API 和 RectJS 中使用会话对象和会话 ID 进行身份验证吗?
- sql - Postgres对索引列的简单选择太慢了
- laravel-valet - 为什么 Laravel Valet 不在 Catalina 上使用自制软件?
- sql - 如何获得每年 SQLite 的 x 个最佳结果
- scala - Scala中的方法调用反射会导致性能下降吗?
- javascript - 无法使用 Angular 发布到 CosmosDB
- ruby-on-rails - Rails HABTM:通过
- c++ - 执行转换错误的过程
- c++ - 使用 fstream 读取带有浮点数的向量