0

これは私が使用しているmain.xmlであり、myImage_MainとmyImage_Main2の2つの画像がめちゃくちゃになっています。
android:layout_widthをビットマップのサイズに設定する方法はありますか?または、画面のサイズとほぼ同じ500pxに設定しますか?

私が欲しいものの例:

スクロールビュー-------------------------------
|
| 画像1画面上でフルサイズ
|
|
| 画面下部
___________________________________________
| まだ画面に表示されていませんが  
| 下にスクロールして画像2を表示します|
|
|
|
| _____________________________________________ |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >


     <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:layout_gravity="top"
        >
        <Button android:id="@+id/myButton_Search"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/btn_search"
    android:layout_gravity="top"
    />
    <Button android:id="@+id/myButton_Save"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/btn_save"
    android:layout_gravity="top"
    />
    </LinearLayout>

     <EditText
     android:id="@+id/myEdittext"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_gravity="bottom"
     />
 <ScrollView android:id="@+id/ScrollView01"
 android:layout_width= **Right here I want to get the size of the image i use as the width**
 android:layout_height=**Right here I want to get the size of the image i use as the height**
 android:fillViewport="true"
 android:scrollY="100px"
 >
 <LinearLayout android:id="@+id/LinearLayout02"
 android:layout_width=**Right here I want to get the size of the image i use as the width**
 android:layout_height=**Right here I want to get the size of the image i use as the height**
 android:orientation="vertical">
    <ImageView android:id="@+id/myImage_Main"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:scaleType="fitCenter"
   />
   <ImageView android:id="@+id/myImage_Main2"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:scaleType="fitCenter"
   />
   </LinearLayout>
   </ScrollView>
</LinearLayout>
4

1 に答える 1

1

wrap_contentそれらすべてに使用してください。レイアウトがで膨らむとsetContentView(R.layout.your_layout)、すべての子ビューを表示するために必要な幅の正確な量が決まります。scaleType="none"ただし、設定する必要があります。あなたが何を達成しようとしているのか完全にはわかりませんので、質問を誤解している場合は、明確にしてください。

于 2010-11-09T02:02:26.697 に答える