新しいLintツールを自分のコードに置きます。それは多くの良い提案を思い付いたが、私は理解できない。ImageViewとTextViewを含むLinearLayoutの代わりに複合ドロアブルを使用するには
このタグとその子は、一と化合描画可能
問題に置き換えることができる:現在のノードが、化合物ドローアブルを用いてのTextViewで置き換えることができるかどうかをチェック。 ImageViewのが含まれているとのTextViewをより効率的に、ここで
そして、描画可能な化合物として取り扱うことができる
AのLinearLayoutは私のレイアウトである
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/upImage"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:scaleType="centerInside"
android:src="@drawable/up_count_big">
</ImageView>
<TextView
android:id="@+id/LikeCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginBottom="1dp"
android:textColor="@color/gray"
android:textSize="16sp"
android:layout_gravity="center_vertical">
</TextView>
</LinearLayout>
誰かが作る方法の具体的な例を提供することができますこの場合、化合物引出し可能か?
私が通常無効にするチェックの1つは、誤検出のためです。このように 'TextView' /' ImageView'コンボをすべて置き換えることはできません。 –
@RichardLeMesurierイメージのサイズを定義する場合は、カスタム表示を使用できます。これにより、視界が明るくなります。私の答えを見てください: http://stackoverflow.com/a/31916731/2308720 – Oleksandr
@Alex多くの場合、私の経験で私はよく私が考えていることを回避するためのカスタムビューを作成するのは価値がないバグのリントチェックであること。 –