關於Android資原始檔中出現百分號的問題
編輯strings.xml的時候,提示 %編譯不通過。
<string name="url">http://aa.cc.com/dd?g=%rasdf</string>
或者
<string name="message_content'>這裡是積分 %1s 積分,佔比%2s %</string>
提示下面的錯誤
Multiple annotations found at this line: - error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? - error: Unexpected end tag string
出現這個錯誤的原因主要是因為strings字串中包含百分號(%),
有幾種方式解決
1.用兩個百分號表示一個百分號即
<pre code_snippet_id="440326" snippet_file_name="blog_20140801_4_7825261" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><pre code_snippet_id="440326" snippet_file_name="blog_20140801_1_4607705" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><string name="url">http://aa.cc.com/dd?g=%%rasdf</string>
2.用轉義符表示
<pre code_snippet_id="440326" snippet_file_name="blog_20140801_5_5110046" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><pre code_snippet_id="440326" snippet_file_name="blog_20140801_1_4607705" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><string name="url">http://aa.cc.com/dd?g=\%rasdf</string>
3.根據錯誤提示可知,如果字串無需格式化,可在<string 標籤上增加屬性:formatted="false",即
</pre><p></p><pre code_snippet_id="440326" snippet_file_name="blog_20140801_6_7934728" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><pre code_snippet_id="440326" snippet_file_name="blog_20140801_6_7934728" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><pre code_snippet_id="440326" snippet_file_name="blog_20140801_1_4607705" class="html" name="code" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.0499992370605px; background-color: rgb(255, 255, 255);"><string name="url" <span style="font-family: 'Microsoft YaHei', 微軟雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 24.0499992370605px;">formatted="false" </span>>http://aa.cc.com/dd?g=%rasdf</string>
相關推薦
關於Android資原始檔中出現百分號的問題
編輯strings.xml的時候,提示 %編譯不通過。 <string name="url">http://aa.cc.com/dd?g=%rasdf</string> 或者 <string name="message_conten
Android資原始檔中各種XML的作用與解釋
眾所周知,XML是一種可擴充套件標記語言,它被用來傳輸和儲存資料。在Android中也會隨處可見XML檔案,包括一個android專案不可缺少的AndroidManifest.xml清單檔案,res資
android中從values/strings資原始檔中獲取拼接字串的方法
在編寫程式碼的時候,將程式碼中的字串儲存在res/values/strings資原始檔裡是一個好習慣,也是規範的做法。但是,有時候我們可能會碰到字串拼接的問題, 比如: <string name="selected">選擇了n個檔案</string>,這裡的n是隨著實
Android資原始檔string.xml中\u2026的意思
今天看了一個string.xml檔案,對其中的一行程式碼中包含的\u2026不是很理解,後來查閱資料後發現了其中的意思。 程式碼如下: <resourcesxmlns:xliff="
Android 比對國際化資原始檔中的翻譯缺失
因為app要做英文,繁體,中文,目前三種翻譯。然後目前還在用eclipse開發,導致有的時候編譯器並沒有提示哪些有缺失翻譯。 又經常新增。導致有的欄位可能有漏掉。不僅僅是研發會漏掉,也有可能是翻譯人員會漏掉。所以利用閒暇時間,打了個jar包。 目前可以比
無法引用android資原始檔夾中raw資料夾中的檔案
參考:http://www.thinksaas.cn/group/topic/212348/ 環境:eclipse 最近要寫一個讀取txt的文字,在res目錄下新建了一個raw資料夾,並向其中加入了txt檔案,但通過R引用時無法引用。在網上查了一下原因是R和Android
Android 儲存資原始檔中的圖片到本地相簿,並實時重新整理的實現方法!
以上程式碼直接copy即可使用!Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.img_public_no);public static void saveImageToGaller
Android開發-SQLite從資原始檔中資料庫複製到SD到增刪改查-AndroidStudio
覺得博文有用,請點贊,請評論,請關注,謝謝!~最近換工作了,新專案接觸到一些新的知識點,跟大家逐一分享~~首先是SQLite,專案中需要把一個本地幾十兆的本地資料庫放在專案中,實現只用json傳遞少量資料,卻可以實現複雜資料查詢顯示的功能。我分兩塊來說,一個使用SQLiteS
如何解決Android 5.0中出現的警告:Service Intent must be explicit
有些時候我們使用Service的時需要採用隱私啟動的方式,但是Android 5.0一出來後,其中有個特性就是 Service Intent must be explitict ,也就是說從Lollipop開始,service服務必須採用顯示方式啟動。
Android 資原始檔螢幕適配
一、圖片適配: mipmap-xhdpi:720P,表示1280x720解析度,用於存放2x切圖 mipmap-xxhdpi:1080P,表示1920x1080解析度,用於存放3x切圖 mipmap-xxxhdpi:2K,表示2560x1440解析度,用於存放4x切圖
Android資原始檔strings實現特殊字元轉義
<div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post"
Android 資原始檔規範(layout、id等)
經過學習總結的幾個命名法 1.下劃線命名法:如 activity_main, 主要用在res下面檔名和其中的string,color的name 和layout的id。 (量最多,也解釋了為何用下劃線) 2.小駝峰命名法:如 getXX(),
c#使用System.Media.SoundPlayer播放資原始檔中的wav檔案
c#使用System.Media.SoundPlayer播放資原始檔中的wav檔案 建立: System.Media.SoundPlayer soundplayer = new System.Media.SoundPlayer(); 初始化路徑: soundplayer.SoundLocat
android資原始檔overlay
aapt aapt stands for Android Asset Packaging Tool. This tool is part of the SDK (and build system) and allows you to view,
Android開發規範之------Android 資原始檔命名與使用
以下主要引用阿里巴巴 Android 開發手冊: Android 資原始檔命名與使用: 【推薦】資原始檔需帶模組字首。 【推薦】layout 檔案的命名方式。 Activity 的 layout 以 module_activity 開頭 Fragment 的 la
C#呼叫Resources.resx資原始檔中的資源
使用到了.NET中的資原始檔,也就是Resources.resx,於是就學會了如何呼叫資原始檔中的資源。首先,資原始檔可以從專案屬性中的資源標籤新增。比如,我新增一個圖片,叫做aaa.png,新增入資原始檔後,可以給他命名,比如叫它aaa。如此,新增檔案就完成了。然後,在程式
Android下載sdk中出現如下錯誤時:Failed to rename directory...解決辦法
1、備份tools資料夾 2、將temp資料夾下的ToolPackage.new01改名為tools並替換原來的tools 3、重新啟動SDK Setup 好了,問題解決了,開啟sdk你就可以看到正在下載platform和api了。
Android資原始檔命名規範學習手冊
【推薦】 資原始檔需帶模組字首。【推薦】 layout 檔案的命名方式。 Activity 的 layout 以 module_activity 開頭 Fragment 的 layout 以 module_fragment 開頭 Dialog 的 layout 以 module_dialog 開頭
關於android資原始檔那些事。
很多時候,我們拿到一個開發到一半的專案來接手做的時候,很多時候 都感覺一團亂麻,有的是沒註釋,有的是程式碼可讀性差,各種引數,數值隨意放,這時候我們就需要把他們放到他們該去的地方,減少專案的維護難度,為後來接鍋的人留條活路。 在android中的資源指的是非程式碼部分的,指
C# 獲取資原始檔中的DLL,呼叫DLL中的方法
轉自:http://blog.163.com/[email protected]/blog/static/16920433220127193511096/ usingSystem;usingSystem.Collections.Generic;usingSyst