ImageView に負の上部マージンを設定しようとすると、問題が発生しました。これを行うと、ImageView はもう表示されませんが、負の左マージンと正の上マージンを使用するとすべて正常に動作します。誰でも私を助けることができますか?ImageView を相対レイアウトの xml コードに追加します。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout android:id="@+id/file_detail_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipToPadding="false" >
</RelativeLayout>
</ScrollView>
Imageviews を追加する方法
RelativeLayout l = ((RelativeLayout)(rootView.findViewById(R.id.file_detail_layout)));
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(preview.getWidth(), preview.getHeight());
params.leftMargin = 50;
params.topMargin = 60;
l.addView(imgView, params);
params = new RelativeLayout.LayoutParams(preview.getWidth(), preview.getHeight());
params.leftMargin = -10;
params.topMargin = -10;
l.addView(imgView2, params);
ps: imgView は表示されますが、imgView2 は表示されません。