アクティビティが開始されると、ユーザーには左側が表示されます。
- つまり、上部の緑色のビューがトリミングされ、下部のみが表示されます
- 下の赤いビューはインタラクティブな方法で表示され、ユーザーはたとえば赤いボタンを押すことができます
- 緑のビューの上部に登録されたタッチ イベントは機能しません (上部が表示されない上に)。
ユーザーが緑色のビューの下部に触れると、緑色のビュー全体が表示されるはずです
- たとえば、緑のビューの上部マージンを設定できないのはなぜですか (この画像がどのように生成されたかと同様です) - 緑のビューは、ジェスチャー検出を含み、これらのジェスチャーに一定の方法で応答するという意味で特別です。これはフルサイズに大きく依存しているため、緑色のビューのサイズを変更することはできませんが、その一部を非表示にする必要があります (ユーザーが下部に触れる前)。
助言がありますか?
右側の XML、緑色のビューのサイズを変更せずに左側を取得する方法
緑のビューは実際には TextView ではなく、外観のジェスチャー主導のアニメーションを備えたカスタム ビューグループです。
<?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">
<RelativeLayout
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="@drawable/border_red">
<Button
android:background="@drawable/btn_red"
android:text="View Below Visible"
android:textSize="20sp"
android:layout_centerInParent="true"
android:layout_width="260dp"
android:layout_height="60dp"/>
</RelativeLayout>
<TextView
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="@drawable/btn_green"
android:text="View with Special Gesturing"
android:textColor="@color/white"
android:textSize="20sp"
android:gravity="bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</RelativeLayout>