2012-07-13 16 views
7

मेरे पास पूछने के लिए एक बहुत ही सरल सवाल है: मुझे स्क्रीन के निचले दाएं क्षेत्र में एक छवि दृश्य, बड़ी स्क्रीन पर एक छोटा लोगो डालना होगा, लेकिन मुझे नहीं पता कि कैसे निर्देशांक सेट करें या छवि दृश्यों को एक सापेक्ष स्थिति में कैसे कहें।एंड्रॉइड, ImageView ImageView

कुछ इस तरह:

enter image description here

+0

आप फ़्रेमलेआउट में देख सकते हैं। [हेरेस] (http://mobileorchard.com/android-app-development-%E2%80%93-layouts-part-three-frame-layout-and-scroll-view/) एक अच्छा लिंक, उम्मीद है कि यह आपकी मदद करे । – Antrromet

उत्तर

8

इस

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:src="@drawable/ic_launcher" /> 

    <ImageView 
     android:id="@+id/imageView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:src="@drawable/ic_launcher" /> 

</RelativeLayout> 

आउटपुट

enter image description here

+0

धन्यवाद मैंने कोशिश की और पहली कोशिश की – Stefano

+0

'रिलेटिवलाउट' कुंजी है! मैं रैखिक लेआउट का उपयोग कर रहा था। – ThunderWiring

2

उपयोग FrameLayout की कोशिश करो।

प्रति गूगल ब्लॉगस्पॉट नमूना

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <ImageView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 

     android:scaleType="center" 
     android:src="@drawable/golden_gate" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="20dip" 
     android:layout_gravity="center_horizontal|bottom" 

     android:padding="12dip" 

     android:background="#AA000000" 
     android:textColor="#ffffffff" 

     android:text="Golden Gate" /> 

</FrameLayout> 

जो तुम उत्पादन

enter image description here

बस आपकी आवश्यकताओं के अनुरूप यह tweak निम्नलिखित दे देंगे के रूप में।

संबंधित मुद्दे