如何将TextView字符串添加双引号,例如"我是谁"
之前有些人提议写在布局文件里面
例如:
android:text="点击"\我\"
但是很抱歉,这样写是会有错误的。
其实按理说不会报错啊,但是事与愿违。
最好想到一种方式:
写在String.xml文件中
<string name="xieguang">"\""</string>
然后布局中添加
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/xieguang"
android:textColor="@color/item_app_name"
android:textSize="48px"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是谁"
android:textColor="@color/item_app_name"
android:textSize="48px"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/xieguang"
android:textColor="@color/item_app_name"
android:textSize="48px"
/>
</LinearLayout>
这样处理的字体就是"我是谁"
ok完美解决。