2017-01-04 2 views
1

単純なイメージをimageviewに表示しようとしていますが、ソースイメージに存在しない写真の周りに境界線が追加されているようです。私はimageviewを親ビューに置き、イメージをイメージに設定しました。エディタでは、境界線の小さなスライバを見ることができますが、デバイスやエミュレータでそれを実行すると、より多くの境界線が表示されます。Imageviewは、ソースイメージに存在しない写真の周りの境界線を表示します。

国境があった場合には写真のサイズを外してみましたが、それは修正されませんでした。以下は、エミュレータとその違いを示すエディタの写真です。

エディタ: enter image description here

エミュレータ: 任意の助けをいただければ幸いですenter image description here

、ありがとうございました。

EDIT:あなたのイメージのように保存されているもの

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_home_screen" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="frolicindustries.strandstudybible.HomeScreen" 
android:weightSum="1" 
android:background="@android:color/background_light" 
android:orientation="vertical" 
android:baselineAligned="false"> 
<!--android:scaleType="fitCenter"--> 
<!--android:cropToPadding="false"--> 
<!--android:layout_weight="0.01"--> 

<Button 
    android:text="Button" 
    android:layout_width="wrap_content" 
    android:id="@+id/About" 
    android:background="@drawable/aboutgradient" 
    android:layout_alignParentBottom="true" 
    android:layout_height="65sp" 
    android:layout_marginBottom="1dip" 
    android:layout_marginTop="1dip" 
    android:layout_alignRight="@+id/Extras" 
    android:layout_alignEnd="@+id/Extras" 
    android:layout_alignLeft="@+id/Bible" 
    android:layout_alignStart="@+id/Bible" /> 

<Button 
    android:text="Button" 
    android:layout_width="wrap_content" 
    android:id="@+id/Extras" 
    android:background="@drawable/extragradient" 
    android:layout_height="65sp" 
    android:layout_above="@+id/About" 
    android:layout_marginTop="1dip" 
    android:layout_alignRight="@+id/WTFW" 
    android:layout_alignEnd="@+id/WTFW" 
    android:layout_alignLeft="@+id/Bible" 
    android:layout_alignStart="@+id/Bible" /> 

<Button 
    android:text="Button" 
    android:layout_width="wrap_content" 
    android:id="@+id/Bible" 
    android:background="@drawable/biblegradient" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" 
    android:elevation="0dp" 
    android:layout_height="65sp" 
    android:layout_marginLeft="-5dip" 
    android:layout_marginRight="-5dip" 
    android:layout_above="@+id/WTFW" /> 

<Button 
    android:text="Button" 
    android:layout_width="wrap_content" 
    android:id="@+id/WTFW" 
    android:background="@drawable/wtfwgradient" 
    android:layout_height="65sp" 
    android:layout_above="@+id/Extras" 
    android:layout_marginTop="1dip" 
    android:layout_alignRight="@+id/Bible" 
    android:layout_alignEnd="@+id/Bible" 
    android:layout_alignLeft="@+id/Bible" 
    android:layout_alignStart="@+id/Bible" /> 

<ImageView 
    android:id="@+id/imageView2" 
    android:src="@drawable/logo" 
    android:background="@null" 
    tools:targetApi="lollipop" 
    android:layout_width="match_parent" 
    android:adjustViewBounds="false" 
    app:srcCompat="@drawable/logo" 
    android:layout_alignRight="@+id/Bible" 
    android:layout_alignEnd="@+id/Bible" 
    android:layout_height="155sp" /> 

<ImageView 
    android:layout_width="match_parent" 
    android:src="@drawable/title" 
    android:id="@+id/imageView3" 
    android:layout_weight="0.29" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/Bible" 
    android:layout_alignRight="@+id/imageView2" 
    android:layout_alignEnd="@+id/imageView2" 
    android:cropToPadding="false" 
    android:scaleType="centerCrop" 
    android:adjustViewBounds="true" 
    android:layout_below="@+id/imageView2" /> 
</RelativeLayout> 
+0

これは9・パッチ画像ですか? – Opiatefuchs

+0

私はそう考えています。ソースの画像からさまざまなスケールの画像を生成するツールがありました – staticFlow

+0

xmlファイルを投稿してください。 – Jiyeh

答えて

2
この、

私のxml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    android:background="#000" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.example.charu.its2017huree.MainActivity" 
    tools:showIn="@layout/app_bar_main" 
    android:orientation="vertical"> 


<ImageView 
    android:background="#FFF" 
    android:src="@drawable/amanda" 
    android:id="@+id/my_image_view" 
    android:layout_width="match_parent" 
    android:layout_height="300dp" /> 


</LinearLayout> 

チェック私はimageViewを設定していると私はそれは左右の縁だと間違って何かがあるようだがわかりました。私はmatch_parentを私のimageViewに与えました。私は自分のimageViewに背景色を追加して、何が起こっているのか調べます。

しかし、それだけでは私には境界線も見たいと思っていません。それはあなたのAndroid携帯にあります!カテゴリの下

設定>開発者向けのオプション>(スクロールビットダウン)オプションショーがある図面レイアウト境界> ..そのオプションにチェックを入れミリメートルあなたは通常、あなたのmobile.Itのは、それが可能になるでグリッドのいくつかの種類を取得あなたがそのオプションを解除すると消えてしまいます。

enter image description here

レッツ・バックイメージビューにジャンプし、それが今どのように見えるかを確認!

  1. 今私は明らかに私がイメージ
  2. の後ろで追加の背景色もイメージ図幅の境界が細かい見ることができ、それはmatch_parentだ。あなたは、あなたのレイアウト境界からそれを見ることができます。

enter image description here

MMはすべて右..画像が正しく合わなかったように、私はandroid:scaleType="fitXY"ようscaleTypeで何かをしようとして実行し、それが今であるかを確認聞こえる彼女が完全なスペースをとっているようです。 。私は私のimageViewに意味:D

あなたが明確に識別することができます。この方法でwhat'w間違ったであなたのimageView

enter image description here

+0

こんにちは..あなた..あなたは..彼女を見ないでください!その有用なヒットとupvote場合:D –

+0

あなたはどのIDEを使用していますか?私はアンドロイドスタジオでそのオプションをつかむことはできません。 – staticFlow

+0

@staticアンドロイドスタジオからアンドロイドスタジオからOSアンドロイドを入手してください。あなたの電話には –

0

xmlファイルを追加しましたか?私は拡張子.pngを提案します。私の画像がjpgか何か他のものであるときに私は境界を得るでしょう。

+0

画像は高解像度のベクトルグラフィックスファイルですが、 :) – staticFlow

関連する問題