草庐IT

comment_parent

全部标签

android - 在 Android 中获取 subview 以 match_parent

我有一个简单的线性布局,我正在适配器中对其进行膨胀:@OverridepublicViewgetView(finalintposition,ViewconvertView,finalViewGroupparent){if(convertView==null){convertView=inflater.inflate(R.layout.category_listview_row,parent,false);}else{((LinearLayout)convertView).removeAllViews();}if(LAYOUT_TYPES.GRID.equals(layoutType))

android - 自定义对话框中的 ImageView - fill_parent 不起作用,我的对话框很小

我有一个简单的要求:我必须在对话框中放一些图片(一些小分辨率,一些大分辨率)并全屏显示。我试过这个:Dialogdialog=newDialog(getActivity());dialog.setContentView(R.layout.custom_dialog);intpicId=Integer.valueOf(webcamCursor.getString(webcamCursor.getColumnIndex("_id")));dialog.setTitle(webcamCursor.getString(webcamCursor.getColumnIndex("City")));

android - 非法状态异常 : Could not find method insert(View) in a parent or ancestor Context class android. support.v7.widget.AppCompatButton

我已经在单个项目中启动了该程序,该程序运行正常。但是,当我复制并粘贴到一个更大的项目中时,它会在logcat中出现以下错误。FATALEXCEPTION:mainProcess:com.example.alan.mainactivity,PID:11545java.lang.IllegalStateException:Couldnotfindmethodinsert(View)inaparentorancestorContextforandroid:onClickattributedefinedonviewclassandroid.support.v7.widget.AppCompat

Android match_parent 未按预期工作

在我的布局文件中,我使用根ScrollView和子LinearLayout。我对此进行了搜索,但没有得到帮助。我在父View和subview中设置了ma​​tch_parent。但是subview有问题。subview不像父View那样填充。这是图片和xml代码。布局文件。 最佳答案 在ScrollView中尝试android:fillViewport="true"。 关于Androidmatch_parent未按预期工作,我们在StackOverflow上找到一个类似的问题:

android - 布局问题 : SliderDrawer doesn't fill parent width

我在Android中使用SliderDrawer。在抽屉里,我有一个布局,其中包含一个膨胀的布局。这是最终结果:请注意抽屉的内容(灰色)如何不占用父级(黑色区域)的整个宽度。这是抽屉代码(main_layout.xml):[更新2,添加了整个代码:]这里是充气区域的代码(media_player_container.xml):你能发现我做错了什么吗??[更新1]这是我膨胀布局的代码(在onCreate()内部):LinearLayoutcontainer=(LinearLayout)this.findViewById(R.id.media_player_container);Layou

android - 为什么我会收到 "Error Retrieving parent for item: No resource found that matches the given name ' @android :style/Theme. Dialog.Alert'”?

在我的项目属性中,我有Android2.2,团队中的另一个人能够很好地构建。我在res->values下的themes.xml文件中收到错误ErrorRetrievingparentforitem:Noresourcefoundthatmatchesthegivenname'@android:style/Theme.Dialog.Alert'.因此我无法构建我的项目。这是一个正确的项目,我从SVN存储库获取并导入到Eclipse中。@style/DA.TextView 最佳答案 我遇到了同样的问题。尝试增加list文件中的min-s

android - TextView 将布局参数设置为 fill_parent 时垂直写入文本

我正在尝试将TextView添加到扩展LinearLayout的View中。当我将其布局参数的宽度设置为fill_parent或wrap_content时,TextView中的文本将垂直显示如下。例如TEXT但是,当我将宽度设置为某个固定数字时,它会正常显示或如我所料。例如文本我的问题是为什么会发生这种情况以及如何解决它,即我应该如何以编程方式设置以便TextView可以水平写入文本而无需为其设置固定宽度,例如设置fill_parent或wrap_content?这里是扩展LinearLayout的父ilGallery的XML代码设置:以下是我如何初始化其中的子项的代码:ilViewP

android - GlSurfaceView setZMediaOrder 导致视频在其 parent 之外播放

案例一:GLSurfaceView|FrameLayout|TextureView|VideoRecording所以这里我有一个GLSurfaceView,根据用户输入,我在它上面添加了一个正方形FrameLayout(使用布局参数设置尺寸),然后添加TextureView在这个新添加的FrameLayout之上,然后录制视频,正如预期的那样,无论选择什么相机,我都会得到一个方形预览。案例2:GLSurfaceView|FrameLayout|GLSurfaceView|VideoPlayback在案例1中,我在录制视频后添加了另一个GLSurfaceView,方法是从已添加的Fram

Android:具有 match_parent 的 LinearLayout 与父级不匹配

我有以下xml:LinearLayout具有灰色背景。我希望这个背景填满整个屏幕(蓝条和黑条之间的空间),所以我将LinearLayout的高度设置为match_parent,但它一直包裹着包含内容的列表,所以我得到了一个白色间隙。这是它的样子:谁能给我一个关于如何制作这个的提示?谢谢!编辑:petromo和Tanis.7x几乎是正确的。一些父View没有占用所有可用空间。我修复了它,现在所有父View都占用了所有空间。第一个未填充空间的View是我发布的LinearLayout(IDfilters_view_container)。它有android:layout_height="ma

android - 在 fragment : "The specified child already has a parent. You must call removeView() on the child' s parent first"中使用数据绑定(bind)时出现异常

安卓工作室3.1,java1.8我尝试使用数据绑定(bind):此处settings.xml布局:这里是fragmentSettingsFragment.java:publicclassSettingsFragmentextendsFragment{@Nullable@OverridepublicViewonCreateView(LayoutInflaterinflater,@NullableViewGroupcontainer,@NullableBundlesavedInstanceState){SettingsBindingbinding=DataBindingUtil.setCo