2013-07-22 4 views
6

私は開発者の設定でGPU Overdrawオーバーレイをオンにして、私のアプリがあまり最適化されていないことに気づきました。ここにそのイメージがあります。GPU Overdrawを最適化して下げる - Android

enter image description here

赤のセクションでは、リストビューの一部ですので、それは私が同じスタイルを維持しながら、それを最適化する方法がわからないところです。 は、ここで、各リストビューセクションのlayout.xmlです:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/background_card" 
android:orientation="horizontal" 
android:padding="5dip" > 

<ImageView 
    android:id="@+id/list_image" 
    android:layout_width="50dip" 
    android:layout_height="50dip" 
    android:src="@drawable/gta5thumb" 
    android:padding="3dip" 
    android:background="@drawable/image_bg" 
    android:layout_centerVertical="true"/> 





<TextView 
    android:id="@+id/title" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignTop="@id/list_image" 
    android:layout_toRightOf="@id/list_image" 
    android:text="Grand Theft Auto 5" 
    android:textColor="#040404" 
    android:textSize="18sp" 

    android:layout_marginLeft="4dp" 
    android:textStyle="bold"/> 

<TextView 
    android:id="@+id/date1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/title" 
    android:textColor="#343434" 
    android:textSize="14sp" 
    android:layout_marginTop="1dip" 
    android:layout_toRightOf="@id/list_image" 
    android:layout_marginLeft="4dp" 
    android:text="17th September 2013" /> 
<TextView 
    android:id="@+id/date2" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/date1" 
    android:textColor="#343434" 
    android:textSize="14sp" 
    android:layout_marginTop="1dip" 
    android:visibility="visible" 
    android:layout_marginLeft="4dp" 
    android:layout_toRightOf="@id/list_image" 
    android:text="17th September 2013" /> 
<TextView 
    android:id="@+id/date3" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textColor="#343434" 
    android:textSize="14sp" 
    android:layout_marginLeft="4dp" 
    android:text="17th September 2013" 
    android:layout_below="@+id/date2" 
    android:layout_toRightOf="@+id/list_image"/> 

<TextView 
    android:id="@+id/platforms" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_alignTop="@id/title" 
    android:gravity="right" 
    android:text="360, PS3" 
    android:layout_marginRight="3dip" 
    android:textSize="12sp" 
    android:textColor="#10bcc9" 
    android:textStyle="bold"/> 

<!-- Rightend Arrow -->  
<ImageView android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/arrow" 
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true"/> 

</RelativeLayout> 

私は本当にこれを整理して失われていると私はあなたが起こっているGPUオーバードローを和らげる手助けをしたいことがあり、他のファイルを与えることが幸せです。私はそれがListViewであるので、何をすべきかわかりませんので、簡単に変更することはできません。スタイルは可能な限り近くに保管する必要があることに注意してください。

答えて

5

RelativeLayoutとあなたの行の子供は問題ではないようです。代わりに、それらの背後にあるものです。

ジャンク(または同様の対象範囲:: cough ::でよく評価されているAndroidデベロッパー向けの書籍)の診断には、Romain Guy's epic blog postをお読みください。具体的には、階層ビューを使用して何に何が重なっているかを判断し、不必要なレイヤーを完全に取り除こうとするか、色がZ軸の上位のものと完全に重なっている場合は少なくとも透明にします。

デザインの変更が必要な場合や、現在の外観を達成する際に重大な複雑さが必要な場合があります。たとえば、5dipの埋め込みにより、ListViewがページ内に挿入されています。つまり、その背後にあるものはすべてエッジを覗いています。したがって、ユーザーの目に見えるように、その背後にあるものを取り除くことも、完全に透明にすることもできません。 5dipボーダーのみが存在し、インテリアは透明ですが、それは乱雑になる可能性があります。

その他のものは修理が簡単です。たとえば、青い縞模様の下に青い縞模様がある緑色の帯は、緑色の帯がページ背景の大部分に重ねられたViewであることを示しています。オーバーラップさせるのではなく、縦に積み重ねることができれば、オーバードローのピンチがなくなります。

(もちろん、それは私があなたがここに ViewPagerを使用していることを推測している、と私は ViewPagerベースのUI上でオーバードローを確認したことがないよう、 ViewPagerそれを行うことができます)
関連する問題