2016-05-30 7 views
0

ImageView(src = "Image")をImageViewの内側に配置しようとしたときにこのレイアウトを使用しました。イメージがImageViewボーダーを展開して画面全体をカバーしました。私のレイアウトImageViewはイメージに適合しません

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight=".5" 
     android:orientation="vertical" 
     > 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight=".5" 
      android:id="@+id/firstFrame" 
      android:layout_margin="@dimen/LayoutMargin" 
      android:elevation="6dp" 
      android:background="@color/frame1" 
      android:orientation="horizontal" 
      > 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:id="@+id/imageView" 
       android:layout_gravity="left|center_vertical" 
       android:layout_weight=".5" 
       /> 
      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_weight=".5" 
       android:orientation="vertical" 
       > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_weight=".5" 
        android:gravity="center" 
        android:scaleType="centerCrop" 
        /> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_weight=".5" 
        android:gravity="center" 
        android:scaleType="centerCrop" 
        /> 

      </LinearLayout> 
     </LinearLayout> 

this is the Layout

私はイメージがImageViewの国境、 内部で任意の解決策になるとしてくださいしたいですか?

+0

アンドロイド用 およびその逆を入れ、その後、幅=の0dpを置く必要があります。scaleType = "fitCenter"はすべての画像ビューでこのラインコードを使用します。画像ビューで画像を調整しています... –

+1

体重を正しく使用していません。 –

+0

その動作していません,,,すべてのScalTypeの種類が機能していません – Maysara

答えて

0

問題は重量 にあったので、あなたはuがしたい重量、縦1

0

最初のLinearLayoutに問題があります。これは、レイアウト重さではなくsumWeightでなければならず、構造が不完全である可能性があります。あなたは(水平)としてリニアレイアウトを使用する場合

+0

bro ,,,あなたが見るLinearLayout、別のLinearLayoutからのちょうど一部 – Maysara

+0

ああ、正しい構造になるように、構造全体を挿入してください。 – diegokspt21

+0

あまりにも大きすぎます – Maysara

関連する問題