android - Can't alight TextView toRightOf ImageView -


the textview doesn't alight right (end) of imageview reason. see battery image , percents.

current:

enter image description here

expected:

enter image description here

the code:

... <relativelayout     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:layout_weight="1.3">     <imageview         android:layout_width="wrap_content"         android:layout_height="fill_parent"         android:layout_alignparentleft="true"         android:layout_alignparentstart="true"         android:scaletype="fitstart"         android:id="@+id/battery_level"         />     <textview         android:layout_width="wrap_content"         android:layout_height="fill_parent"         android:layout_torightof="@id/battery_level"         android:layout_toendof="@id/battery_level"         android:layout_alignend="@id/battery_level"         android:layout_alignright="@id/battery_level"         android:layout_marginleft="6dp"         android:layout_marginstart="6dp"         android:id="@+id/battery_level_percents"         style="@style/blue_textviewstyle"         /> </relativelayout> ... 

any idea causes behaviour?


edit: if hardcode image source imageview , text textview looks in design view:

enter image description here

the code of it:

    android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentleft="true"     android:layout_alignparentstart="true"     android:scaletype="fitstart" 

seems wrap_content doesn't work.

try add android:adjustviewbounds="true" imageview.

the bounds might big if source picture larger.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -