开发者

can you tell me what is the problem in my code [closed]

开发者 https://www.devze.com 2023-04-04 06:41 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Am using horizontal scrollview in relative layout.But am not getting correct alignment of the edittext and buttons,and even am not getting the scroll view too.Please tell me what is wrong in my code.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/serviceslayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_toRightOf="@id/layout1"
    android:background="#fff">

  <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#333333" android:scrollbarFadeDuration="0">

    <RelativeLayout
       android:id="@+id/serviceslayout2"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:layout_toRightOf="@id/layout1"
       android:background="#fff">

       <TextView android:layout_width="wrap_content" android:id="@+id/txtTieover" android:textColor="#000" android:layout_height="65px" android:text="tie-over" android:layout_below="@+id/txtQuantity2" android:layout_alignParentLeft="true" android:layout_marginLeft="21dp" android:layout_marginTop="13dp"></TextView>

       <TextView android:layout_width="wrap_content" android:id="@+id/txtQuantity2" android:textColor="#000" android:layout_height="wrap_content" android:text="Quanti开发者_JS百科ty" android:layout_alignParentTop="true" android:layout_centerInParent="true"     android:layout_toRightOf="@+id/txtTieover" android:layout_marginLeft="155dp" android:layout_marginTop="20dp" android:layout_gravity="center_horizontal"></TextView>

       <TextView android:layout_width="wrap_content" android:id="@+id/textView1" android:textColor="#000" android:layout_height="70px" android:text="insert" android:layout_below="@+id/txtTieover" android:layout_alignRight="@+id/txtTieover" android:layout_marginTop="1dp"></TextView>

       <TextView android:layout_width="wrap_content" android:id="@+id/textView2" android:textColor="#000" android:layout_height="55px" android:text="direct bury" android:layout_below="@+id/textView1" android:layout_toLeftOf="@+id/txtQuantity2" android:layout_marginTop="1dp"></TextView>

    </RelativeLayout>
 </HorizontalScrollView>
</RelativeLayout>


I think that using android:layout_width="wrap_content" android:layout_height="wrap_content" in horizontal scroll view is weird. You'd better specify exact value or "fill_parent" to horizontal scroll view.


I want to suggest you this really usefeul tutorial about View Hierarchy and ui profiling : http://mobile.tutsplus.com/tutorials/android/android-tools-leveraging-the-hierarchy-viewer-for-ui-profiling/


Firstly, your relative layout with id: serviceslayout as been aligned toRightOf another layout ( which im hoping has been declared since there is no layout with id layout1 in your code given above).
Also, if your layout1 (if defined) has in its layout_width as fill_parent then none of the above relative layouts will be visible...so make sure your layout1 isnt filling up the whole screen.
Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消