私はこれに完全に多くの時間を費やしました。元々、私はXML onclickステートメントと並行して単純な「onAction」メソッドを使用して、ExpandableListView内にあるボタンを制御していました。実行時にボタンをより細かく制御できるように、インフレーションを使用するとよいと思いました。あなたはここで以前の投稿を見ることができます
これは私の最新の試みです。例外やエラーは発生しません。何もしません。私はこのバージョンが少し遠いことを知っているので、時間があれば、私がすでに試したことがあるかもしれない何かを提案する前に、他のいくつかの試みについて上記のリンクをチェックしてください!
BrowserActivity.class
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.browse);
ViewGroup parent = (ViewGroup) findViewById(R.id.expandLinLayout);
ExpandableListView browseView = (ExpandableListView) findViewById(android.R.id.list);
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.row, parent);
LinearLayout linLay = (LinearLayout) view
.findViewById(R.id.LinearLayout1);
TextView rowTxt = (TextView) view.findViewById(R.id.txtItem);
rowTxt.setTextColor(Color.CYAN);
.........
}
リストを含むbrowse.xmlコード:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:id="@+id/expandLinLayout"
>
<ExpandableListView
android:id = "@android:id/list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:groupIndicator="@drawable/my_group_statelist"
>
</ExpandableListView>
</LinearLayout>
そして最後にrow.xmlコード:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:layout_gravity="center_vertical|right"
android:id="@+id/txtItem"
android:text="Item"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
></TextView>
</LinearLayout>
どんな助けや提案も大歓迎です。