2

如何在 Android 中将视图部分放置在屏幕之外?到目前为止,需要滑入的视图放置在 RelativeLayout 内,这是整个布局文件。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <WebView
        android:id="@+id/webViewLink"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
    <WebView
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
</RelativeLayout>

第二个 webview 需要部分位于屏幕之外。

4

1 回答 1

0

您可以android:layout_marginRight="-30dp"按照@user1490103 的建议使用。或者你可以使用android:translationX. 如果您打算为此视图设置动画,则翻译会更有意义。记得在RelativeLayout上设置。android:clipChilren="false"

于 2016-11-16T19:14:25.963 回答