草庐IT

border-width

全部标签

安卓 : stroke in a shape create a margin of the stroke width

我创建了一个矩形形状以将其用作列表项背景。我的问题是笔画不跟随View边框,而是留出+/-笔画宽度的边距。这是我的形状的xml:这是我风格的xml:match_parentwrap_contentvertical@drawable/bordurechamp最后是我的列表项View的xml: 最佳答案 包围你的shape与...标签和设置top,bottom,left和right的属性您想要的边距值。然后包裹整个item与.见下文:...如果你愿意padding(而不是margin),请参阅AhmadAghazadehanswer下面

安卓 : stroke in a shape create a margin of the stroke width

我创建了一个矩形形状以将其用作列表项背景。我的问题是笔画不跟随View边框,而是留出+/-笔画宽度的边距。这是我的形状的xml:这是我风格的xml:match_parentwrap_contentvertical@drawable/bordurechamp最后是我的列表项View的xml: 最佳答案 包围你的shape与...标签和设置top,bottom,left和right的属性您想要的边距值。然后包裹整个item与.见下文:...如果你愿意padding(而不是margin),请参阅AhmadAghazadehanswer下面

android - android :scaleType ="fitCenter" only work with fix Layout_width and Layout_height attributes?

我使用Layout_width="fill_parent"和Layout_height="wrapcontent"。如果图像比ImageView大,它将被完美地缩小。但是,我从来没有使用它来放大较小的图像。我尝试了ScaleType的任意组合和“AdjustViewBounds”:它总是在ImageView的中间保持自己的大小。这是代码... 最佳答案 我刚刚找到了让它工作的方法。这适用于2.1(AVD)和4.1.2(设备) 关于android-android:scaleType="fi

android - android :scaleType ="fitCenter" only work with fix Layout_width and Layout_height attributes?

我使用Layout_width="fill_parent"和Layout_height="wrapcontent"。如果图像比ImageView大,它将被完美地缩小。但是,我从来没有使用它来放大较小的图像。我尝试了ScaleType的任意组合和“AdjustViewBounds”:它总是在ImageView的中间保持自己的大小。这是代码... 最佳答案 我刚刚找到了让它工作的方法。这适用于2.1(AVD)和4.1.2(设备) 关于android-android:scaleType="fi

Android 选项卡布局 : Wrap tab indicator width with respect to tab title

有什么方法可以根据标签标题包装标签指示器的宽度吗? 最佳答案 是的,可以将标签指示符作为标题设置填充到0publicvoidwrapTabIndicatorToTitle(TabLayouttabLayout,intexternalMargin,intinternalMargin){ViewtabStrip=tabLayout.getChildAt(0);if(tabStripinstanceofViewGroup){ViewGrouptabStripGroup=(ViewGroup)tabStrip;intchildCount=(

Android 选项卡布局 : Wrap tab indicator width with respect to tab title

有什么方法可以根据标签标题包装标签指示器的宽度吗? 最佳答案 是的,可以将标签指示符作为标题设置填充到0publicvoidwrapTabIndicatorToTitle(TabLayouttabLayout,intexternalMargin,intinternalMargin){ViewtabStrip=tabLayout.getChildAt(0);if(tabStripinstanceofViewGroup){ViewGrouptabStripGroup=(ViewGroup)tabStrip;intchildCount=(

Android可绘制: Specifying shape width in percent in the XML file?

我正在尝试创建一个简单的Drawable,我想将其设置为View的背景(使用setBackgroundDrawable)。我只是想将drawable的背景分成2个相等的矩形(50%-50%),第一个要填充黑色,第二个填充白色:如何在可绘制XML定义文件中指定每个形状的宽度应为50%?像android:width="50%".(我正在开发Android3.0,但我认为这是一个普遍的Android问题。)P.S:您可以在CSS或XAML中执行此操作。 最佳答案 您不能指定百分比。您需要为其指定一个维度值。android:width在这里

Android可绘制: Specifying shape width in percent in the XML file?

我正在尝试创建一个简单的Drawable,我想将其设置为View的背景(使用setBackgroundDrawable)。我只是想将drawable的背景分成2个相等的矩形(50%-50%),第一个要填充黑色,第二个填充白色:如何在可绘制XML定义文件中指定每个形状的宽度应为50%?像android:width="50%".(我正在开发Android3.0,但我认为这是一个普遍的Android问题。)P.S:您可以在CSS或XAML中执行此操作。 最佳答案 您不能指定百分比。您需要为其指定一个维度值。android:width在这里

android - 警报对话框 : How To Remove Black Borders Above and Below View

之前有人问过这个问题:AlertDialogcustomtitlehasblackborder但没有得到满意的回答-并且缺少一些信息。我正在尝试在Android中创建一个没有标题且底部没有任何按钮的自定义对话框。但是,生成的对话框在View的顶部和底部有黑色“边框”/“间距”/一些东西。来自theDocumentation:AdialogmadewiththebaseDialogclassmusthaveatitle.Ifyoudon'tcallsetTitle(),thenthespaceusedforthetitleremainsempty,butstillvisible.Ifyo

android - 警报对话框 : How To Remove Black Borders Above and Below View

之前有人问过这个问题:AlertDialogcustomtitlehasblackborder但没有得到满意的回答-并且缺少一些信息。我正在尝试在Android中创建一个没有标题且底部没有任何按钮的自定义对话框。但是,生成的对话框在View的顶部和底部有黑色“边框”/“间距”/一些东西。来自theDocumentation:AdialogmadewiththebaseDialogclassmusthaveatitle.Ifyoudon'tcallsetTitle(),thenthespaceusedforthetitleremainsempty,butstillvisible.Ifyo