2010-06-16 15 views
11

आप किसी अन्य दृश्य के "मध्य" भाग के सापेक्ष विचारों को कैसे संरेखित करते हैं?अन्य विचारों के बीच में विचारों को संरेखित कैसे करें बेसलाइन?

मुझे लगता है कि यह यूआई की तस्वीर के साथ सबसे अच्छी तरह से समझाया गया है जिसे मैं एंड्रॉइड में बनाने की कोशिश कर रहा हूं।

alt text

उत्तर

2

मैं usedthe कोड इस प्रकार है, लेकिन यह अभी भी कुछ कमियों है: आप मूल्य को संशोधित करना चाहिए:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/widget" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 

android:layout_gravity="center_horizontal|center_vertical" 
> 
<EditText 
    android:id="@+id/bullet" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 

    android:paddingRight="4dip" 
    android:includeFontPadding="false" 
    android:lines="4" 
    android:text="hidhidihfidhfdifhdifhdifhidhfidf" /> 
<ImageView 
    android:id="@+id/icon" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="#ffff00" 
    android:src="@drawable/icon" 
    android:layout_alignTop="@id/bullet" 

    android:layout_marginLeft="50dip" /> 

    <ImageView 
    android:id="@+id/icon1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 

    android:background="#ff00ff" 
    android:layout_alignBottom="@id/bullet" 

    android:layout_marginLeft="100dip" 
    android:src="@drawable/star_logo" /> 

    </RelativeLayout> 
1

@pengwang और जिसे यह चिंता का विषय हो सकता है

आधारभूत लाइन को संदर्भित करता है किसी भी दृश्य, बटन, छविदृश्य, या किसी भी नियंत्रण के आधार पर। जब आप आधारभूत संपत्ति का उपयोग कर रहे हैं तो आप उस आधार के किसी भी आईडी को दे रहे हैं जिसे आप संदर्भित करना चाहते हैं या वह स्थान जहां आप अपना बटन या कोई भी चाहते हैं। जब आप चित्रमय दृश्य में स्विच यह है कि यह कैसे आधारभूत जिसके लिए आप को परिभाषित किया है

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 
    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 
     <ImageButton 
      android:id="@+id/iB" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/ic_launcher" 
      android:layout_alignParentBottom="true" /> 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button" 
      android:layout_alignParentBottom="true" 
      android:layout_toRightOf="@id/iB" 
      android:layout_alignBaseline="@id/relativeLayout1" /> 
    </RelativeLayout> 
</LinearLayout> 
0

इस

<EditText 
     android:id="@+id/searchedittext" 
     android:layout_width="fill_parent" 
     android:layout_height="50dip" 
     android:hint="Search Events, Restaurants, Businesses" 
     android:singleLine="true" 
     android:textSize="15dip" /> 

    <Button 
     android:id="@+id/searchbtn" 
     android:layout_width="40dip" 
     android:layout_height="40dip" 
     android:layout_marginLeft="-50dip" 
     android:background="@drawable/ic_menu_search" /> 
    <Button 
     android:id="@+id/searchbtn2" 
     android:layout_width="40dip" 
     android:layout_height="40dip" 
     android:layout_marginLeft="-30dip" 
     android:background="@drawable/ic_menu_search" /> 
</LinearLayout> 
-1

की तरह कुछ करने के पतों अपने माता पिता को देखने के अपने दृष्टिकोण को केंद्र रखने के लिए दिखाता हूँ आपको बस इस संपत्ति को निर्दिष्ट करने की आवश्यकता है एंड्रॉइड: गुरुत्वाकर्षण = "केंद्र"

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