Android setText作品为肖像画,而非风景画
我遇到了一个问题,我在网上找不到类似的问题 我有两种不同的布局,一种用于纵向模式,另一种用于横向模式。 当我在Xml文件中将文本设置为textView时(例如Test123),它会以纵向模式显示,但不会以land模式显示 这是非常令人困惑的,因为昨天它工作得很好,而今天它不工作,我不记得对那些xml文件做了任何更改 这是我的xml文件 纵向xml:Android setText作品为肖像画,而非风景画,android,xml,Android,Xml,我遇到了一个问题,我在网上找不到类似的问题 我有两种不同的布局,一种用于纵向模式,另一种用于横向模式。 当我在Xml文件中将文本设置为textView时(例如Test123),它会以纵向模式显示,但不会以land模式显示 这是非常令人困惑的,因为昨天它工作得很好,而今天它不工作,我不记得对那些xml文件做了任何更改 这是我的xml文件 纵向xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layo
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
app:fontFamily="@font/caprina_font"
android:textColor="#ffffff"
android:textAllCaps="true"
android:text="@string/session_comparison"
android:layout_marginBottom="10dp"/>
<LinearLayout
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="1pt"
android:background="@color/white" />
</LinearLayout>
<LinearLayout
android:weightSum="10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_width="50dp"
android:layout_height="match_parent"
app:srcCompat="@drawable/ic_thumbs_up"/>
</LinearLayout>
<LinearLayout
android:layout_weight="6"
android:layout_width="0dp"
android:layout_height="wrap_content">
<ImageView
android:layout_marginRight="-8dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="19dp"
app:srcCompat="@drawable/ic_triangle"/>
<TextView
android:id="@+id/etat_de_forme_text"
android:textAlignment="center"
android:text="test 1 2 3"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue_all_rounded_shape"
android:textColor="@color/white"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</LinearLayout>
横向xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
app:fontFamily="@font/caprina_font"
android:textColor="#ffffff"
android:textAllCaps="true"
android:text="@string/session_comparison"
android:layout_marginBottom="10dp"/>
<LinearLayout
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="1pt"
android:background="@color/white" />
</LinearLayout>
<LinearLayout
android:weightSum="11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false">
<LinearLayout
android:layout_marginLeft="20dp"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:gravity="center">
<ImageView
android:layout_gravity="center"
android:layout_width="50dp"
android:layout_height="match_parent"
app:srcCompat="@drawable/ic_thumbs_up"/>
<ImageView
android:layout_marginRight="-8dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="19dp"
app:srcCompat="@drawable/ic_triangle"/>
<TextView
android:id="@+id/etat_de_forme_text"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="test 1 2 3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue_all_rounded_shape"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
<com.github.mikephil.charting.charts.RadarChart
android:id="@+id/chart"
android:visibility="gone"
android:clickable="false"
android:layout_height="400dp"
android:layout_width="match_parent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
编辑:
我无法发布代码,因为代码太长,所以这里有一个下载链接:尝试在
scape.xml
文件中从顶部和底部删除填充
<LinearLayout
android:layout_marginLeft="20dp"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="wrap_content" <== change to wrap_content
android:layout_marginStart="20dp"
android:gravity="center">
...
<TextView
android:id="@+id/etat_de_forme_text"
android:paddingLeft="10dp"
android:paddingRight="10dp"
//android:paddingTop="10dp" <== remove this
//android:paddingBottom="10dp" <== remove this
android:text="test 1 2 3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue_all_rounded_shape"
android:textColor="@color/white"/>
...
</LinearLayout>
尝试从横向.xml
文件的顶部和底部删除填充
<LinearLayout
android:layout_marginLeft="20dp"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="wrap_content" <== change to wrap_content
android:layout_marginStart="20dp"
android:gravity="center">
...
<TextView
android:id="@+id/etat_de_forme_text"
android:paddingLeft="10dp"
android:paddingRight="10dp"
//android:paddingTop="10dp" <== remove this
//android:paddingBottom="10dp" <== remove this
android:text="test 1 2 3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue_all_rounded_shape"
android:textColor="@color/white"/>
...
</LinearLayout>
能否显示java filepost错误日志..在旋转屏幕前后如何使用savedInstanceState
?我没有错误日志,我用Kotlin文件编辑帖子你能显示java文件帖子错误日志吗..你在旋转屏幕前后如何使用savedInstanceState
吗?我没有错误日志,我用Kotlin文件编辑帖子哦,好的,现在我可以看到一些文本(我在代码中设置了programmaticaly)。但是文本视图的高度不会自动调整,因为它现在正在工作,谢谢!我对包装内容和匹配父母了解很多!哦,好的,现在我可以看到一些文本(我在代码中设置了programmaticaly)。但是文本视图的高度不会自动调整,因为它现在正在工作,谢谢!我对包装内容和匹配父母了解很多!