ポップアップを表示するために、次のレイアウトがあります。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ppba_dimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dimming"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ppba_llPopup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_gravity="center"
android:orientation="vertical"
android:background="@drawable/popup_bg">
<!-- HEADER: Titol del Popup-->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#10bcc9"
android:typeface="sans"
android:textSize="15dip"
android:textStyle="bold"
android:padding="12dip"
android:text="@string/ppfa_tvTitolPopup" />
<!-- Linia-->
<View
android:background="#10bcc9"
android:layout_height="2dp"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_width="fill_parent"/>
<!-- Pais i Ciutat-->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="@string/ppfa_tvPaisCiutat"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"/>
<Spinner
android:id="@+id/ppba_spPaisos"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip" />
<Spinner
android:id="@+id/ppba_spCiutats"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"/>
....
(i crop it, just because it's too long)
</LinearLayout>
</LinearLayout>
このレイアウトは次のようになります。
画像を投稿することは許可されていないようですので、ここにリンクを張らせていただきます
一部のデバイス画面では、長すぎるためにポップアップがトリミングされることに気付きました。そこで、次のようなScrollviewを追加することにしました(2番目のLinearLayoutの後、実際にはポップアップウィンドウ):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ppba_dimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dimming"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ppba_llPopup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_gravity="center"
android:orientation="vertical"
android:background="@drawable/popup_bg">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<!-- HEADER: Titol del Popup-->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#10bcc9"
android:typeface="sans"
android:textSize="15dip"
android:textStyle="bold"
android:padding="12dip"
android:text="@string/ppfa_tvTitolPopup" />
<!-- Linia-->
<View
android:background="#10bcc9"
android:layout_height="2dp"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_width="fill_parent"/>
<!-- Pais i Ciutat-->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="@string/ppfa_tvPaisCiutat"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"/>
<Spinner
android:id="@+id/ppba_spPaisos"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip" />
<Spinner
android:id="@+id/ppba_spCiutats"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"/>
...
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
そして、レイアウトは次のようになります。
こちらの画像
私は異なる「layout_width」を試しましたが、それぞれが奇妙な結果をもたらします。私は何か間違ったことをしていると確信していますが、何が起こっているのか理解できません。良い方向に向けてください。
ありがとう!