2015-09-04 96 views
0

我有一個應用程序ExpandableListView如下。Expandable列表視圖Android Dropdown Alignment

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <ExpandableListView 
     android:id="@+id/android:list" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 

</LinearLayout> 

ExpandableListView初始化具有延伸ExpandableListActivity一項活動的onCreate方法中下面的代碼。

ExpandableListView expandableView = getExpandableListView(); 

expandableView.setIndicatorBounds(width - GetDipsFromPixel(50), width - GetDipsFromPixel(10)); 

expandableView.setAdapter(new DataExpAdaptor(this, _currentDate.getTimeInMillis(), _isShowAddress)); 

expandableView.setOnItemLongClickListener(handleItemLongClicks); 

這個直到最近一直工作正常,我們的銀河S3迷你,但由於更新銀河S4迷你(是Android 4.4.2)&銀河S5(是Android 5.0))的新版本列表視圖是現在左對齊下拉項目時,這以前是正確對齊。

我需要同時支持現有硬件(Galaxy S3 Mini)和較新的硬件,但似乎不能設置下拉框的對齊方式。左對齊或右對齊並不重要,我只需要可靠地知道一種方式或另一種方式?

銀河S3右對齊

Galaxy S3 Right Align


銀河S4左對齊

enter image description here

回答

0

請共享代碼,在其中設置了ExpandableListView。由於RTL支持,最終指標和右側指標之間存在巨大差異。如果你正在使用結束,然後切換到右邊

+0

更新的問題與進一步的信息。我不知道你是否想要佈局信息或代碼初始化? –

1

我認爲該圖標是默認設置,你不能做任何事情。但你可以通過把下面的XML線隱藏它,

android:groupIndicator="@null" 

現在在頁眉的XML,你可以把自己的圖標... 讓我知道,如果你是這樣的...... 。希望幫助...

+0

感謝您的幫助。我能夠通過檢測當前版本的android並根據版本對對齊進行排序來繞過此問題。我真的不想像上面提到的那樣替換列表視圖上的圖像,但這是我的計劃B. –