可能重复:
在字符串资源中强制执行空格
这是我用于Android项目的strings.xml文件.
........
........
<string name="bcount">Block Count\t\t\t: </string>
<string name="fbcount">Free Blocks\t\t\t: </string>
<string name="blsiz">Block Size\t\t\t: </string>
<string name="newvfs">New VFS</string>
<string name="mknewfold">Making new folder </string>
<string name="creating">Creating </string>
........
........
Run Code Online (Sandbox Code Playgroud)
这个问题是朝向字符串末尾的空格"Block Count\t\t\t: "消失了.只"Block Count\t\t\t:"返回java.如何解决这个问题?
我必须在我的应用程序中实现一个简单的自定义软键盘,并且我也想在键盘上显示重音字符。
\n\n它们是:\n\xc3\xad、\xc3\xa9、\xc3\xa1、\xc5\xb1、\xc3\xba、\xc5\x91、\xc3\xb3、\xc3\xbc、\xc3\xb6
\n\n我的问题是如何在键盘 xml 中映射这些?这些的关键代码是什么?我在官方KeyEvent文档中找不到它们。
\n\n我当前的键盘定义 xml 如下所示:
\n\n\n\n<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"\n android:keyWidth="10%p"\n android:horizontalGap="0px"\n android:verticalGap="0px"\n >\n\n<Row android:keyHeight="16%">\n <Key android:codes="45" android:keyLabel="q" android:keyEdgeFlags="left"/>\n <Key android:codes="51" android:keyLabel="w"/>\n <Key android:codes="33" android:keyLabel="e"/>\n <Key android:codes="46" android:keyLabel="r"/>\n <Key android:codes="48" android:keyLabel="t"/>\n <Key android:codes="54" android:keyLabel="z"/>\n <Key android:codes="49" android:keyLabel="u"/>\n <Key android:codes="37" android:keyLabel="i"/>\n <Key android:codes="43" android:keyLabel="o"/>\n <Key android:codes="44" android:keyLabel="p" android:keyEdgeFlags="right"/>\n</Row>\n\n<Row android:keyHeight="16%">\n <Key android:codes="?" android:keyLabel="\xc3\xb6" android:keyEdgeFlags="left"/>\n <Key android:codes="?" android:keyLabel="\xc5\x91"/>\n <Key android:codes="?" android:keyLabel="\xc3\xbc"/>\n <Key android:codes="?" android:keyLabel="\xc5\xb1"/>\n <Key android:codes="?" android:keyLabel="\xc3\xb3"/>\n <Key android:codes="?" android:keyLabel="\xc3\xa9"/>\n <Key android:codes="?" android:keyLabel="\xc3\xa1"/>\n <Key android:codes="?" android:keyLabel="\xc3\xad" android:keyEdgeFlags="right"/>\n</Row>\n</Keyboard>\n …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我想创建一个具有ExpandableListView并在他下面CheckBox的页面.
我的问题是我的ExpandableListView太大,使CheckBox不在页面中.
在较小的屏幕上根本看不到.
我试图将ExpandableListView放在scrollview中,但它不起作用.
有没有办法让我的设计?
这是我的代码和截图.
XML代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/White" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="15sp"
android:text="In this page you can save a group of exercise under one routine."
android:textColor="@color/Black"
android:textSize="20sp" />
<ExpandableListView
android:id="@+id/instructionsExView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="15sp" >
</ExpandableListView>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/instructionsExView"
android:layout_marginTop="15sp"
android:text="If you want to open the instruction again check 'need help?'"
android:textColor="@color/Black"
android:textSize="20sp" />
<CheckBox
android:id="@+id/checkInstructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) I have a custom fonts BebasNeue.otf which i want to set in the strings variables. I have searched a lot but did not get any solution.
I know we can set the custom fonts in views like textView.setTypeface(font);. But now i want to set the fonts to the Strings which i have as below :
String Name,Contact;
Name="ABCD";
Contact="97696538";
Run Code Online (Sandbox Code Playgroud)
This all the strings contains some values. Now i want to set the custom fonts to all the strings which …
我正在尝试创建一个Android XML Drawable,我可以将其用作我的一个LinearLayouts的背景.我需要背景才能有一个图像,左上角和右上角的圆角半径为10dp.我一直在尝试下面的代码,但似乎无法让它工作.这可能吗?任何帮助是极大的赞赏!!
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:topLeftRadius="10dp"
android:topRightRadius="10dp">
</corners>
</shape>
</item>
<item>
<bitmap android:src="@drawable/bg_navbar_blur" />
</item>
Run Code Online (Sandbox Code Playgroud)
我想像下面这样绘制,

我能够在两个不同的 xml 文件中制作矩形和三角形形状。但我想将它们联合起来制作像这样的可绘制对象。
简而言之,我有一个带有style.xml和的多主题项目style.xml(v21)。这两个版本唯一的区别是在v21版本的每个主题中都额外增加了这两行:
<item name="android:navigationBarColor">?attr/colorPrimaryDark</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
而且我不维护两个样式文件,因为它们太熟悉了,所以有什么办法可以合并这两个样式xml文件,或者使v21一个扩展style.xml,当我要进行一些修改时,我只需要与style.xml
android android-xml android-resources android-studio android-styles
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorRed"
android:background="@drawable/ic_delete"/>
Run Code Online (Sandbox Code Playgroud)
如上所述,我为 ImageView 背景添加了一个 Android VectorAsset。
我可以通过如下 xml 将该矢量资产的颜色从红色更改为蓝色。
android:backgroundTint="@color/colorBlue"
Run Code Online (Sandbox Code Playgroud)
但我想以编程方式改变它的颜色。
我有一个textview和它大小32sp在xml。
android:textSize="32sp"
Run Code Online (Sandbox Code Playgroud)
我想以28sp编程方式更改它。所以我使用了下面的代码。
txt.setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.twenty_eight_sp));
Run Code Online (Sandbox Code Playgroud)
但是上面的代码是添加28sp到32sp. 所以字体变得太大了。我不想添加字体大小,我想设置一个新的字体大小。
任何人都可以建议我。
我在 Windows 的 Android Studio 中创建了一个应用程序。现在我的资源文件“ style.xml”有问题。它不显示/存在。检查附加的图像:
XML 文件的图像
如何显示它?
谢谢!