I have a page called 'SimpleResultPage'. In this page I display a detail view from different kind of items i have in my app.
At the start of the activity I determine what kind of items it should display and based on that I hide/show ViewStub
's
Currently I try to display an Image in betweent two textfields and this is the code:
<TextView
android:id="@+id/Simple_Result_Text_Title_1"
style="@style/Style_Simple_Result_Title"/>
<ViewStub
android:id="@+id/Image1_ViewStub"
android:inflatedId="@+id/Image1_Inflated_ViewStub1"
style="@style/Style_Simple_Result_Image"
android:layout="@layout/simple_list_image"/>
<TextView
android:id="@+id/Simple_Result_Text_Text_1"
style="@style/Style_Simple_Result_Text"/>
The style for the image is this:
<style name="Style_Simple_Result_Image">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">center</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:layout_marginBottom">20dp</item>
</style>
But somehow the image is always small and isn't showing it the way I want 开发者_如何学JAVAit to (fill the complete width and leave 20dp margin on both sides).
How should I adjust the code to make it the way I want it?
Does changing the line
<item name="android:scaleType">center</item>
to
<item name="android:scaleType">center_inside</item>
make any difference?
精彩评论