Android layout weight imageview not visible -


i have confusing problem android layout. when use 1 imageview image not visible, if use 2 imageview (one dummy view) can see images. problem exist in hvga resolution (320x480). think because images resolution. because when use number_one.png image (124x133px) fine, if use result.png(597x90) need use dummy view see it. here code

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"      android:layout_height="wrap_content" android:paddingleft="@dimen/activity_horizontal_margin"      android:orientation="vertical"      android:paddingright="@dimen/activity_horizontal_margin"      android:paddingtop="@dimen/activity_vertical_margin"      android:paddingbottom="@dimen/activity_vertical_margin"      tools:context=".mainactivity$placeholderfragment">        <!--<textview android:text="@string/hello_world" android:layout_width="wrap_content"-->      <!--android:layout_height="wrap_content" />-->                <linearlayout          android:layout_width="fill_parent"          android:layout_height="0dip"          android:layout_weight="1"            android:gravity="center"          >         //if use number_one.png(124x133) fine         //result.png 597x90           <imageview          android:id="@+id/result"          android:layout_width="0dip"          android:layout_weight="1"          android:layout_height="wrap_content"          android:src="@drawable/result"          />      //dummy imageview (i dont need use if use number_one.png      <imageview          android:id="@+id/resultx"          android:layout_width="0dip"          android:layout_weight="0"          android:layout_height="wrap_content"          android:src="@drawable/number_one"          />              </linearlayout>        <linearlayout          android:layout_width="fill_parent"          android:layout_height="0dip"          android:layout_weight="1"            android:gravity="center"          >            <imageview              android:id="@+id/number_one"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_one"              />            <imageview              android:id="@+id/number_two"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_two"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/number_three"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_three"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/add"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/add"              android:layout_marginleft="10dp"              />      </linearlayout>          <linearlayout            android:layout_width="fill_parent"          android:layout_height="0dip"          android:layout_weight="1"          android:gravity="center"              >          <imageview              android:id="@+id/number_four"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_four"              />            <imageview              android:id="@+id/number_five"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_five"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/number_six"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_six"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/sub"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/sub"              android:layout_marginleft="10dp"              />      </linearlayout>        <linearlayout          android:layout_width="fill_parent"          android:layout_height="0dip"          android:gravity="center"          android:layout_weight="1"          >          <imageview              android:id="@+id/number_seven"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_seven"              />            <imageview              android:id="@+id/number_eight"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_eight"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/number_nine"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/number_nine"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/mul"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/mul"              android:layout_marginleft="10dp"              />      </linearlayout>        <linearlayout          android:layout_width="fill_parent"          android:layout_height="0dip"          android:gravity="center"          android:layout_weight="1"          >          <imageview              android:id="@+id/clear"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/clear"              />            <imageview              android:id="@+id/backspace"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/backspace"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/div"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/div"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/equal"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/equal"              android:layout_marginleft="10dp"              />      </linearlayout>        <linearlayout          android:layout_width="fill_parent"          android:layout_height="0dip"          android:gravity="center"          android:layout_weight="1"          >          <imageview              android:id="@+id/clearx"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/clear"              />            <imageview              android:id="@+id/backspacex"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/backspace"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/divx"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/div"              android:layout_marginleft="10dp"              />            <imageview              android:id="@+id/equalx"              android:layout_width="0dip"              android:layout_weight="0.25"              android:layout_height="wrap_content"              android:src="@drawable/equal"              android:layout_marginleft="10dp"              />      </linearlayout>  </linearlayout>

sorry english.

edit: fixed change parent layout_height fill_parent

don't forget define orientation on linearlayout

android:orientation="vertical" 

or horizontal..


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -