我设计了非常重的嵌套设计,如下所示,当我的列表扩展列表视图时的问题似乎没有滚动这是什么原因,底部表被扩展但没有关注其中的列表视图,如果我滚动触摸“营业时间”文本,它开始滚动,但当它向上时,我无法向下滑动。
_showDialog(BuildContext context) {
print("_showDialog");
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext context) {
return DraggableScrollableSheet(
expand: false,
builder: (context, scrollController) {
return Container(
child: Stack(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Align(
alignment: Alignment.topCenter,
child: Container(
margin: EdgeInsets.symmetric(vertical: 8),
height: 8.0,
width: 70.0,
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadius.circular(10.0)))),
SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Text('Operational Hours',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: widget.isTab(context)
? TabTextStyles.mediumText
.copyWith()
.fontSize
: PhoneTextStyles.mediumText
.copyWith()
.fontSize)),
),
],
),
ListView(
controller: …
Run Code Online (Sandbox Code Playgroud) 片段中有默认构造函数,我想知道它的用途以及它提供的功能?我在没有它的情况下运行代码它工作得很好,我在删除它时找不到任何错误
public class SongListFragment extends Fragment {
private static final String SONG_IDS = "song_ids";
// TODO: Rename and change types of parameters
private int[] songIds;
private OnFragmentInteractionListener mListener;
public SongListFragment() {
// Required empty public constructor
}
// TODO: Rename and change types and number of parameters
public static SongListFragment newInstance(int[] songIds) {
SongListFragment fragment = new SongListFragment();
Bundle args = new Bundle();
args.putIntArray(SONG_IDS, songIds);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) …
Run Code Online (Sandbox Code Playgroud) 我的应用无法启动它安装后立即崩溃,我无法理解错误!
我为两个片段创建了两个recylcerView,它们附加在主活动xml文件中
错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.invincible.fragfrag, PID: 14384
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.invincible.fragfrag/com.invincible.fragfrag.MainActivity}: android.view.InflateException: Binary XML file line #14: Error inflating class android.support.v7.app.AlertController.RecycleListView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2521)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class android.support.v7.app.AlertController.RecycleListView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
at com.invincible.fragfrag.MainActivity.onCreate(MainActivity.java:13)
at android.app.Activity.performCreate(Activity.java:6100) …
Run Code Online (Sandbox Code Playgroud) xml android android-fragments android-fragmentactivity android-studio