2011-07-25 24 views
1

私は現在画像がimageviewです。 2.7インチのテスト画面では完璧に見えますが、4.3インチの画面でテストすると、イメージはどこにあるのかわかりません。高さをdpに設定しています。イメージファイルはhdpi、mdpi、およびLdpiの各フォルダにあります。私は何か間違っているのですか?それとも、画像の場所をロックして、すべての電話サイズで同じ方法で表示する方法がありますか?おかげさまで Android-さまざまな画面サイズの画像を調整します

様々な画面サイズに調整されていないimageviewが最初imageview(ID = sdrbg)である ここに私のレイアウトファイルです:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/relativeLayout1" android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:orientation="vertical"> 
    <ImageView android:layout_width="wrap_content" 
     android:layout_alignParentTop="true" android:id="@+id/sdrbg" 
     android:background="@drawable/sdrmaingraphic" android:layout_height="289dp"></ImageView> 

    <ImageView android:id="@+id/canvasBOM" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="false" android:layout_width="fill_parent" 
     android:background="@drawable/canvas" android:layout_height="100dp"> 
    </ImageView> 
    <Button android:layout_alignParentBottom="true" 
     android:id="@+id/playpausebuttonBOM" android:background="@drawable/main_pause_button" 
     android:layout_height="wrap_content" android:layout_width="wrap_content" 
     android:layout_marginLeft="10dp"></Button> 
    <Button android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:id="@+id/nextbuttonBOM" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentBottom="true" android:background="@drawable/next_song_button" 
     android:layout_marginRight="10dp"></Button> 
    <TextView android:id="@+id/textView1" android:layout_height="wrap_content" 
     android:layout_width="wrap_content" android:text="Best of May 2011" 
     android:textSize="20dp" android:textStyle="bold" 
     android:layout_centerHorizontal="true" android:layout_centerVertical="false"></TextView> 
</RelativeLayout> 
+1

ImageViewのレイアウトおよびサイズに影響を与える要因はたくさんあります。あなたはレイアウトファイルを共有できますか? –

+0

@ダン:私のレイアウトコードを追加しました – Splitusa

答えて

1

高さを指定する代わりに、wrap_contentと高さを指定するためのRelativeLayout機能を使用してください。例:android:layout_alignParentTop="true" android:layout_alignBottom="@id/playPauseButtomBOM"およびandroid:layout_marginBottom="xxdp"

+0

これは完全に機能しました。手伝ってくれてどうもありがとう! – Splitusa

0

は私が問題がandroid:layout_height="289dp"であると思い、制御することがないようにしようheight、代わりにpaddingを使用してください

+0

これをテストして結果をお知らせします – Splitusa

関連する問題