현재 두 번째 GroupView
목록에 위의 제목을 포함 할 수 있도록 ExpandableListView
을 정의했습니다. 그러나 이것은 확장 화살표의 흐름이 텍스트와 정렬되지 않고보기의 가운데에 정렬되어 사용자에게 호소력을 발휘합니다. 누구든지이 표정을 더 매력적으로 보이기 위해 할 수있는 것에 대해 어떤 하위 결정을 가지고 있습니까? 두 번째 그룹 뒤에 헤더가 있어야합니다.확장 가능 목록 GroupView의 화살표를 가운데 맞춤되지 않은 텍스트와 정렬해야합니다.
이 코드는 내 사용자 지정 어댑터를 내 GroupView
를 설정하는 것입니다.
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
ViewGroup parent) {
TextView groupTitle = null;
LayoutInflater layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = null;
if(groupPosition == 1){
v = layoutInflater.inflate(R.layout.custom_first_major_language_group_row, null);
} else {
v = layoutInflater.inflate(R.layout.custom_language_group_row, null);
}
groupTitle = (TextView) v.findViewById(R.id.text_element);
String myText = this.getGroup(groupPosition).toString();
groupTitle.setText(myText);
return v;
}
custom_language_group_row.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/text_element"
android:layout_width="fill_parent"
android:layout_height="48dip"
android:textSize="20sp"
android:textColor="#fff"
android:layout_marginLeft="48dip"
android:gravity="center_vertical"
android:text = "Language Group Name"/>
</RelativeLayout>
custom_first_major_language_group_row.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Major Languages"
android:textColor="#000"
android:background="#fff"
android:id="@+id/majorLanguageTitle"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_centerHorizontal="true"></TextView>
<TextView
android:id="@+id/text_element"
android:layout_width="fill_parent"
android:layout_height="48dip"
android:textSize="20sp"
android:textColor="#fff"
android:layout_marginLeft="48dip"
android:gravity="center_vertical"
android:layout_below="@+id/majorLanguageTitle"
android:text = "Language Group Name"/>
</RelativeLayout>
당신은으로 정렬 내가 드롭 다운 화살표를 얻을 수있는 방법의 어떤 아이디어가있는 경우 텍스트 그것은 많이 감사하겠습니다.
동일한 문제가 있습니다 ... 나는 귀하의 게시물을 볼 때 너무 흥분했습니다. 나는 대답을 얻을 것 같았다. –