android - Can't alight TextView toRightOf ImageView -
the textview doesn't alight right (end) of imageview reason. see battery image , percents.
current:
expected:
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:
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
Post a Comment