我正在编写一个具有expandablelist和自定义arrayList的应用程序。我的问题是,expandablelistview不会向我显示子项,也不知道问题出在哪里。 arrayList来自我创建的用于在数据库中保存相同数据的类。
我发布以下代码:
ffmpeg -f concat -safe 0 -i mylist.txt -map 0 -c copy concat2.mp4
ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20190212
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025ca95f2dc0] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'mylist.txt':
Duration: N/A, start: 0.000000, bitrate: 6850 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 6017 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s
Metadata:
handler_name : Stereo
Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 320 kb/s
Metadata:
handler_name : Surround
Stream #0:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
Metadata:
handler_name : Stereo
Output #0, mp4, to 'concat2.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 6017 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s
Metadata:
handler_name : Stereo
Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 320 kb/s
Metadata:
handler_name : Surround
Stream #0:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
Metadata:
handler_name : Stereo
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025ca95f9480] Auto-inserting h264_mp4toannexb bitstream filter4x
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025ca95f9480] Auto-inserting h264_mp4toannexb bitstream filter5x
frame=450570 fps=1251 q=-1.0 Lsize=12591157kB time=04:10:34.11 bitrate=6860.8kbits/s speed=41.7x
video:11029679kB audio:1527897kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.267411%
数据类
public class CustomAdapterExpandable extends BaseExpandableListAdapter {
private Context c;
private ArrayList<Data> data;
private FireBaseReadData fireBaseReadData;
private DatabaseReference databaseReference;
private Preference preference = new Preference();
public CustomAdapterExpandable(Context ctx, ArrayList<Data> data) {
this.c = ctx;
this.data = data;
}
@Override
public int getGroupCount() {
return data.size();
}
@Override
public int getChildrenCount(int groupPosition) {
data.get(0).get(groupPosition);
return data.size();
}
@Override
public Object getGroup(int groupPosition) {
return data.get(groupPosition);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return data.get(groupPosition).get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return data.get(0).get(groupPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return data.get(groupPosition).get(childPosition);
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
databaseReference = FirebaseDatabase.getInstance().getReference();
fireBaseReadData = new FireBaseReadData(databaseReference);
if(convertView == null){
convertView = LayoutInflater.from(c).inflate(R.layout.mainlayout, parent, false);
}
TextView name = (TextView) convertView.findViewById(R.id.TxT_text);
Button Btn_Reg = (Button) convertView.findViewById(R.id.Btn_ShowDialog);
final Data data = (Data) this.getGroup(groupPosition);
name.setText(data.getTournamentName());
Btn_Reg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ShowDialog(groupPosition);
}
});
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
final Data data = (Data) this.getChild(groupPosition, childPosition);
if(convertView == null){
convertView = LayoutInflater.from(c).inflate(R.layout.childlayout, parent, false);
}
TextView register = (TextView) convertView.findViewById(R.id.txt_reg);
TextView players = (TextView) convertView.findViewById(R.id.txt_players);
register.setText(data.getNumberOfPlayer());
players.setText(data.getNumberOfPlayer());
return convertView;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
感谢答案。
答案 0 :(得分:1)
您没有正确设置孩子的尺寸
@Override
public int getChildrenCount(int groupPosition) {
return groupList.get(groupPosition).getChild().size();
}
小组课程
public class Group {
String groupName;
int groupID;
ArrayList<Data>child=new ArrayList<Data>();
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public int getGroupID() {
return groupID;
}
public void setGroupID(int groupID) {
this.groupID = groupID;
}
public ArrayList<Data> getChild() {
return child;
}
public void setChild(ArrayList<Data> child) {
this.child = child;
}
}
然后将ArrayList Of Groups传递给适配器