Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Banding on gradient background for navigation bar. setDither not working
    primarykey
    data
    text
    <p>For some reason I can't get the background of my navbar to render smoothly. What am I doing wrong here? Here is my main activity xml file:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" &gt; &lt;ImageView android:id="@+id/HomeBackground" android:layout_width="match_parent" android:layout_height="match_parent" android:contentDescription="@string/homescreen_desc" android:src="@drawable/homescreen" android:scaleType="centerCrop" /&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/NavigationBar"&gt;&lt;/RelativeLayout&gt; &lt;include android:layout_gravity="bottom" layout="@layout/navigation_main" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Here's the navigation bar that it loads:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/NavigationBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_alignParentBottom="true" android:padding="5dp" android:background="@drawable/gradient_bar_bg"&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"&gt; &lt;ImageButton android:id="@+id/home_button" android:contentDescription="@string/home_btn_txt" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/home" android:scaleType="centerInside" android:tint="#176fe6" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:background="@android:color/transparent"/&gt; &lt;ImageButton android:id="@+id/explore_button" android:contentDescription="@string/explore_btn_txt" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/compass1" android:scaleType="centerInside" android:tint="#176fe6" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:background="@android:color/transparent"/&gt; &lt;ImageButton android:id="@+id/info_button" android:contentDescription="@string/info_btn_txt" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/info2" android:scaleType="centerInside" android:tint="#176fe6" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:background="@android:color/transparent"/&gt; &lt;ImageButton android:id="@+id/social_button" android:contentDescription="@string/social_btn_txt" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/chat" android:scaleType="centerInside" android:tint="#176fe6" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:background="@android:color/transparent"/&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Here's the gradient drawable:</p> <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item&gt; &lt;shape android:shape="rectangle"&gt; &lt;solid android:color="#004097" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:top="2dp"&gt; &lt;shape&gt; &lt;gradient android:angle="90" android:startColor="#FF004097" android:endColor="#FF0153ca" android:type="linear" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/layer-list&gt; </code></pre> <p>Finally, here's the activity:</p> <pre><code>package org.childrensmuseum.visittcmindy; import android.app.Activity; import android.os.Bundle; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getWindow().setFormat(PixelFormat.RGBA_8888); findViewById(R.id.NavigationBar).getBackground().setDither(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload