0
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:id="@+id/linearLayout" 
   android:orientation="vertical" 
   android:layout_width="match_parent" 
   android:layout_height="match_parent" 
   android:gravity="center_horizontal" 
   android:background="@color/background_color">

   <TextView android:id="@+id/titleTextView"
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"
      android:text="@string/quiz_title" 
      android:layout_marginBottom="2dp"
      android:textSize="@dimen/title_size" 
      android:textColor="@color/text_color" 
      android:gravity="center">
   </TextView>

   <TextView android:id="@+id/questionNumberTextView"
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"
      android:layout_marginBottom="2dp" 
      android:layout_marginTop="2dp"
      android:textColor="@color/text_color" 
      android:textSize="@dimen/text_size" 
      android:layout_gravity="center" 
      android:gravity="center"></TextView>


   <ScrollView android:id="@+id/SlotScrollView" 
     android:layout_width="match_parent"           
     android:padding="0dp">          
      <ImageView android:id="@+id/flagImageView"
         android:adjustViewBounds="false" 
         android:layout_width="match_parent"
         android:layout_height="@dimen/flag_height">
      </ImageView>
   <ScrollView

   <TextView android:id="@+id/guessCountryTextView"
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"
      android:layout_marginBottom="2dp" 
      android:layout_marginTop="2dp"
      android:text="@string/choose_answer" 
      android:textColor="@color/text_color"
      android:textSize="@dimen/text_size"></TextView>


   <TableLayout android:id="@+id/buttonTableLayout" 
      android:layout_width="match_parent"
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:stretchColumns="0,1,2,3">
      <TableRow android:id="@+id/tableRow0" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:orientation="horizontal"></TableRow>
      <TableRow android:id="@+id/tableRow1"
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"
         android:orientation="horizontal"></TableRow>
      <TableRow android:id="@+id/tableRow2"
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"
         android:orientation="horizontal"></TableRow>
   </TableLayout>

   <TextView android:id="@+id/answerTextView"
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"
      android:textSize="@dimen/answer_size" 
      android:layout_gravity="center" 
      android:textStyle="bold" 
      android:gravity="center"></TextView>

</LinearLayout> 

画像の表示を最大化して、1。画像の幅が画面の幅よりも小さい場合、画像は拡大され、画面の幅と同じように最大化されます。2.画像の高さが使用可能なスペースよりも大きい場合は、スクロールします。効果は上下に発生します。3。これらのguessCountryTextViewと画像の下のすべてのコンポーネントを表示し、画面の下部に配置する必要があります。

ただし、上記のコードのようにスクロールビューを追加すると、スクロールビューはimageviewから始まる画面全体を占め、guessCountryTextViewのようなわかりにくいものはすべて消えます。

これをどのように修正できますか?どうもありがとう!

4

1 に答える 1

0

線形レイアウトの代わりにrelativelayoutを使用してみてください。スクロールビューにはmatch_parentwidhtとfixedheightを使用します。これは、uが行う必要があるすべてのことです...コードを見てください。ただし、いくつかの調整を行う必要があります。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray" >

    <TextView
        android:id="@+id/titleTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:text="afafafafa"
        android:textColor="@android:color/darker_gray"
        android:textSize="20sp" >
    </TextView>

    <TextView
        android:id="@+id/questionNumberTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/titleTextView"
        android:layout_gravity="center"
        android:textColor="@android:color/darker_gray"
        android:textSize="20sp" >
    </TextView>

    <ScrollView
        android:id="@+id/SlotScrollView"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:layout_below="@+id/questionNumberTextView"
        android:padding="0dp"
        android:color="@android:color/black" >

        <ImageView
            android:id="@+id/flagImageView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="false" >
        </ImageView>
    </ScrollView>

    <TextView
        android:id="@+id/guessCountryTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="2dp"
        android:layout_marginTop="2dp"
        android:text="sfsff"
        android:textColor="@android:color/darker_gray"
        android:textSize="20sp" >
    </TextView>

    <TableLayout
        android:id="@+id/buttonTableLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:stretchColumns="0,1,2,3" >

        <TableRow
            android:id="@+id/tableRow0"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
        </TableRow>
    </TableLayout>

    <TextView
        android:id="@+id/answerTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toRightOf="@+id/buttonTableLayout"
        android:textSize="20sp"
        android:textStyle="bold" >
    </TextView>

</RelativeLayout>
于 2012-11-11T08:43:48.327 に答える