urS*_*Sus 2 android line-breaks textview android-2.3-gingerbread android-4.0-ice-cream-sandwich
我遇到了在ICS之前没有破坏行的textView的问题.在ICS(我相信蜂窝工作,但我没有尝试过))textView中的文本很好地破坏了但在姜饼和文本下面只是一行继续.任何想法如何解决这一问题?
我正在使用viewpager,这是每个屏幕的布局.我使用自定义textView只是为了添加自定义字体,希望这不是问题.
pager_item.xml:`
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="20dp" >
<com.ursus.absolution.startme.MyTextView
android:id="@+id/message_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/quotes_background"
android:gravity="center"
android:textColor="#585858"
android:textSize="25dp" />
<com.ursus.absolution.startme.MyTextView
android:id="@+id/author_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#585858"
android:textSize="20dp" />
</LinearLayout>`
In ICS
_____________
| |
| |
| "This is |
| my cool |
| text" |
| |
|___________|
In gingerbread and below
_____________
| |
| |
| "This is my cool text"
| |
| |
| |
|___________|
Run Code Online (Sandbox Code Playgroud)
对不起我新的我不能发布图片.在此先感谢,希望你们得到它.
/////// UPDATE ///////////////
好吧,伙计们,这很有意思..我尝试了你所有的建议但是没有工作,所以我开始了一个新的空白项目,只是将textview放入布局中,包含很长的字符串,它包裹得很好.
所以,我不知道这是怎么可能的,但它的自定义主题风格动作栏这样做,当我在清单中评论它工作得很好,但系统全息主题似乎这样做
AndroidManifest.xml中
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ursus.absolution.startme"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<application
android:icon="@drawable/iconn"
android:label="@string/app_name"
android:theme="@style/Theme.myStyle" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
</activity>
<activity
android:name=".SplashScreenActivity"
android:label="@string/title_activity_main"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
styles.xml
<resources>
<style name="Theme.myStyle" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@style/mycoolstyle_transparent_ActionBar</item>
</style>
<style name="mycoolstyle_transparent_ActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/transparent_actionbar</item>
</style>
Run Code Online (Sandbox Code Playgroud)
...所以当我在清单中添加android:theme ="@ style/Theme.myStyle"时,textviews行为不端,但是当我添加android:theme ="@ android:style/Theme.Holo"时,我通常会这样做力量全息主题,它也是不可思议的
奇怪的.
此问题以各种形式报告,例如此处和此处.许多问题报告了以前的工作布局,在更新到ICS/holo主题时会被破坏.
我能够轻松地重现它,它是一行xml的问题: @android:style/Theme.Holo
最简单的方法是引入一个版本化的值文件夹,让Android选择正确的文件夹.换句话说,你将有2个styles.xml:
values-v11文件夹中你应该放置你指定的那个(带parent="@android:style/Theme.Holo")values文件夹中,你将把'普通'文件放在里面parent="android:Theme.Black.NoTitleBar".您的清单应保持不变,Android将根据其版本选择正确的xml.解决方案可能不是最优雅的,但至少你不会乱用android:maxlines,android:width等等
| 归档时间: |
|
| 查看次数: |
5560 次 |
| 最近记录: |