草庐IT

my_layout

全部标签

java - 如何解决错误 : Java class cannot be instantiated in XML layout in android?

publicclassBottomToolbarextendsRelativeLayout{privateSpinnercircleSpinner;privateImageButtonoperatorImageButton;privateToggleButtonconntypeToggleButton;privateContextcontext;publicBottomToolbar(Contextcontext,AttributeSetattrs){super(context,attrs);LayoutInflaterlayoutInflater=(LayoutInflater)co

Android Studio layout_behavior 错误

对于为什么我在layout_behavior上收到此错误以及如何修复它有什么建议吗? 最佳答案 您的标签可能与此不同:android.support.design.widget.CoordinatorLayout也许你有android.support.constraint.ConstraintLayout。如果是这样,您应该将其更改为android.support.design.widget.CoordinatorLayout,因为子元素可以应用属性app:layout_behavior="@string/appbar_scroll

Android - 修改 "Graphical Layout"中的布局后,代码会在滚动时自动更改。如何避免这种情况?

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:EclipsewithAndroidlayout'smain.xml?我正在尝试静态设计布局。我写了一个xml文件,现在我正在图形布局模式下修改它。但是,当我切换回XML编辑器并滚动浏览代码时,代码似乎会自动更改。我什至尝试从packageexplorer刷新文件,但仍然无济于事。现在,我早就知道这个问题,但一直忽略了它。如何避免这样的事情发生?谢谢。

java - 是否可以从 layout.xml android 中的 Activity 中获取变量的值?

我需要知道我是否可以从我的主要Activity中获取一个计算数字并从我的layout.xml中访问它。protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);DisplayMetricsdisplaymetrics=newDisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);intheigh

android - 如何修复线性布局中的layout_weight?

在我的xml文件中,我将每个小圆圈(ImageView)设置为具有线性View和layout_weights的屏幕的25%的大小。.这是我手机的屏幕截图(它应该是什么样子)在我的平板电脑上它不会将大小更改为屏幕的25%(这是它的外观)我的代码由三个LinearLayout组成每个包含ImageView的权重为0.25(满分1)。代码如下: 最佳答案 您不能使用png文件作为您的circle_white。如果您选择正确的android:scaleType,从技术上讲您可以完成这项工作,但它会导致可怕的别名渲染。我会先删除您现有的png

android - 谁能给我解释一下 "app:layout_behavior="@string/appbar_scrolling_view_behavior”?

谁能给我解释一下这个属性"app:layout_behavior="@string/appbar_scrolling_view_behavior"? 最佳答案 更改android.support.constraint.ConstraintLayout✖到android.support.design.widget.CoordinatorLayout✓那么子元素就可以使用app:layout_behavior 关于android-谁能给我解释一下"app:layout_behavior="@

android- layout_weight ="0"的含义

我正在使用layout_weight指定android中特定viewGroups中各种View的比例。来自this问题的答案我对layout_weight是什么有一个清晰的概念。我使用普通数学计算了viewGroup中所有views的大小(即我有3个views1,2&3layout_weights并且它们都有layout_height="0dp"然后它们有1/(1+2+3),2/(1+2+3),3/(1+2+3)viewGroup中的空格用于垂直对齐)。但是,layout_weight="0"是什么意思?如何确定layout_weight="0"的View大小?

xml - 以下功能未由 Apache FOP 实现,但 : table-layout ="auto" (on fo:table)

Thefollowingfeatureisn'timplementedbyApacheFOP,yet:table-layout="auto"(onfo:table)我在控制台中收到以上警告。我正在尝试导出到文档。使用相同的XML和XSLT,我可以导出到PDF,但导出到doc会得到空白文档。---------------MyXML-----------------------------OrganisationNEWTEST1AddressLine1AddressLine2AddressLine3N194eh07999999999newmeh@meh.comwww.NOTnewmeh.c

xml - 我如何摆脱 xml :base attribute that is added to my xml document after using xinclude?

我正在尝试使用xinclude将xml文件解码为java对象。我有一个基于我的jaxb注释代码文件的模式。这是我的解码代码:@OverridepublicTreadFromReader(finalReaderreader)throwsException{finalUnmarshallerunmarshaller=createUnmarshaller();finalSAXParserFactoryspf=SAXParserFactory.newInstance();spf.setXIncludeAware(true);spf.setNamespaceAware(true);//spf.s

xml - Q : Sitemap XML - Should I include the #Section links of my single-page website?

正如标题所示,我有一个网站,它是一个用于网页设计服务的单页网站(仅限主页URL),所有菜单链接都指向主页本身的每个#Sections。问题:我应该在网站的SitemapXML文件中包含这些#SectionURL吗?或者,我应该只列出网站的主域名主页,仅此而已?奖励问题:当通过我的导航栏中的链接链接到每个部分时,我应该使用什么格式?示例:要么wwwdotmydomaindotcom/#SectionID(带斜线),要么我应该使用wwwdotmydomaindotcom#SectionID(没有斜线)..?预先感谢您帮助澄清这些问题的正确答案! 最佳答案