2013-02-26 204 views
2

佈局被點擊按鈕

後調整大小我創建了一個線性佈局,其中i添加水平滾動視圖和我添加幾個按鈕在上水平滾動視圖的運行時間。最初看起來很好,但點擊幾個按鈕後,當我點擊類別按鈕類別容器調整大小,如圖像所示。

請幫助我爲什麼發生這種情況是什麼問題 謝謝。

+0

這裏粘貼一些代碼,這將有助於我們解決好模式 – 2013-02-26 11:04:34

+0

你的問題是高度也在不斷縮小?這只是話題轉移的問題嗎? – 2013-02-26 11:05:41

+0

您可以發佈佈局的XML嗎? – m0skit0 2013-02-26 11:07:01

回答

-1

這裏是佈局文件

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

<RelativeLayout 
    android:id="@+id/RelativeLayout_category_panel_main" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/color_category_panel_bg" 
    android:visibility="gone" > 

    <ImageView 
     android:id="@+id/ImageView_previous" 
     android:layout_width="15dp" 
     android:layout_height="20dp" 
     android:layout_alignParentLeft="true" 
     android:layout_centerVertical="true" 
     android:src="@drawable/arrow_left" 
     android:visibility="gone" /> 

    <HorizontalScrollView 
     android:id="@+id/ScrollView_category_panel" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toLeftOf="@+id/ImageView_next" 
     android:layout_toRightOf="@+id/ImageView_previous" 
     android:fadingEdgeLength="15dp" 
     android:scrollbars="none" > 

     <LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/Layout_category_panel_container" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" > 
     </LinearLayout> 
    </HorizontalScrollView> 

    <ImageView 
     android:id="@+id/ImageView_next" 
     android:layout_width="15dp" 
     android:layout_height="20dp" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:src="@drawable/arrow_right" 
     android:visibility="gone" /> 
</RelativeLayout> 

<com.techdeals.rest.ui.widget.IndexableListView 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/RelativeLayout_category_panel_main" 
    android:divider="@drawable/list_divider" 
    android:drawSelectorOnTop="false" /> 

<ImageView 
    android:id="@+id/ImageView_list_divider" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@android:id/list" 
    android:scaleType="fitXY" 
    android:src="@drawable/list_divider" /> 

+3

不要發表這些很多次,你可以編輯原始帖子... – Pragnani 2013-02-26 11:22:17

+0

所有的東西在relativeLayout->設置它的高度爲25dp。然後你的設定去。 – 2013-02-26 11:28:13

+0

@FahadIshaque感謝您的回答,但按鈕上的文字來自底部 – 2013-02-26 11:53:54

-1
Here is Button.xml file which i am inflating at runtime . 

<?xml version="1.0" encoding="utf-8"?> 
<Button xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/Button_category_panel" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:background="@android:color/transparent" 
android:paddingBottom="10dp" 
android:paddingLeft="4dp" 
android:paddingRight="4dp" 
android:paddingTop="10dp" 
android:textSize="16dp" 
android:textStyle="bold" />