expandablelistview があり、グループ アイテムの背景を配置しましたが、高さを調整したいと思います。高さを xml ファイル (50dp) に既に設定していますが、機能しません (実際の高さは 50 dp ではありませんが、より高いです)。そのため、プログラムで行うことを考えています。
ここに、それを説明するための私のコードの一部があります
grouplayout_index.xml
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout_index"
android:background="@drawable/bg_capitolo_retina"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_height="50dp" ---------------------//height = 50 dp
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent" >
<ImageView android:id="@+id/freccia_indice" android:src="@drawable/freccia_o"
android:clickable="false"
android:layout_height="28dp"
android:layout_width="28dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingLeft="10dp" />
<TextView android:id="@+id/tvGroup"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
android:paddingLeft="50dp" />
</LinearLayout>
索引.java
public class Index extends ExpandableListActivity {
.....
IndexAdapter mAdapter = new IndexAdapter .....
explistview.setAdapter(mAdapter);
}
IndexAdapter.java
public class IndexAdapter extends BaseExpandableListAdapter{
....various methods......
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,ViewGroup parent) {
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.grouplayout_index, null);
}
TextView textView = (TextView) convertView.findViewById(R.id.tvGroup);
textView.setTextAppearance(context, R.style.textViewStyleGroup);
textView.setText("textview");
/* I have tried this code but it doesn't works.
LinearLayout ll = (LinearLayout) convertView.findViewById(R.id.LinearLayout_indice);
ll.setLayoutParams(new LinearLayout.LayoutParams(30,50));
*/
}
誰か助けてくれませんか?