2017-09-12 4 views
0

mDPIが360dpで、画面の幅全体を占める画像があります。しかし、私がnexus 5x api 23 xxhdpi screnで画像を見ると、画面全体の幅を占めることはありません。私は1dpがMDPIで1pxに等しいと思ったので、これを標準として使うことができました。したがって、MDPIの360dpは最大幅なので、すべての密度で最大幅になりますか?私は何が欠けていますか?MDPIの360dpがxxhdpiと一致しません

これは私が試みたものです。

enter image description here

このフル画面出力を与える:この画面のサイズを比較し

enter image description here

この同じ360dpで、この1:

enter image description here

出力とを与えます画像が全画面表示されない理由:

enter image description here

constraintLayoutは比率を使用して、推奨される理由は、このですか?

答えて

0

私はこれを最終的に考え出しました。これは、これらの問題を修正するためのレイアウト制約の1つです。この特定のケースでは、使用していたビューのアスペクト比に関するものでした。だから、私は以下のことを行い、アスペクト比は維持された左右の活動の全体のスペースを占めるようにする。私は360×500の比率を望んでいた気に保つ:私はconstraintLayoutを学ぶため

<com.mobile.myapp.customViews.SwippableViewPager 
          android:id="@+id/pager" 
          android:layout_width="0dp" 
          android:layout_height="0dp" 
          android:layout_marginLeft="0dp" 
          android:layout_marginRight="0dp" 
          android:layout_marginTop="0dp" 
          app:layout_constraintDimensionRatio="H,360:500" 
          app:layout_constraintHorizontal_bias="0.0" 
          app:layout_constraintLeft_toLeftOf="parent" 
          app:layout_constraintRight_toRightOf="parent" 
          app:layout_constraintTop_toTopOf="parent" /> 

this overviewは非常に有用でした。

これを保証するもう1つの方法は、廃止予定のビューグループを使用することです。android percentRelativeLayout

関連する問題