Android 测量多行文本视图,高度设置为“包裹”内容不起作用
问题是,Android 测量多行文本视图,高度设置为“包裹”内容不起作用,android,textview,Android,Textview,问题是,TextView(我在布局代码中标记了它)正在切断它的文本,因为它只显示2行中的1行,我不明白为什么会发生这种情况 我尝试在文本视图中使用以下内容(正如我在其他线程中发现的那样): 及 但这并没有任何帮助 布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:ori
TextView
(我在布局代码中标记了它)正在切断它的文本,因为它只显示2行中的1行,我不明白为什么会发生这种情况
我尝试在文本视图中使用以下内容(正如我在其他线程中发现的那样):
及
但这并没有任何帮助
布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="?attr/main_background_color"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
...
<LinearLayout
android:id="@+id/llFolderStyle"
android:orientation="horizontal"
android:background="?selectableItemBackground"
android:padding="4dp"
android:text="@string/action_folder_style"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:src="?ic_color_lens_24dp" />
<LinearLayout
android:orientation="vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:text="@string/action_folder_style"
style="@style/Base.TextAppearance.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- The following text view has two lines
but is measured as if it only has one! -->
<TextView
android:text="@string/action_folder_style_info"
style="@style/Base.TextAppearance.AppCompat.Button"
android:textSize="12sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
android:maxLines="2"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="?attr/main_background_color"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
...
<LinearLayout
android:id="@+id/llFolderStyle"
android:orientation="horizontal"
android:background="?selectableItemBackground"
android:padding="4dp"
android:text="@string/action_folder_style"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:src="?ic_color_lens_24dp" />
<LinearLayout
android:orientation="vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:text="@string/action_folder_style"
style="@style/Base.TextAppearance.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- The following text view has two lines
but is measured as if it only has one! -->
<TextView
android:text="@string/action_folder_style_info"
style="@style/Base.TextAppearance.AppCompat.Button"
android:textSize="12sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>