Fai*_*ikh 8 android textview android-layout android-relativelayout
我有一个问题,我的ScrollView片段自动滚动到底部.因此,要解决这个问题,我已新增下列中的RelativeLayout行中建议这个答案:
android:descendantFocusability="blocksDescendants"
但是在添加这一行之后,textIsSelectable就停止了工作.如何添加两行?
这是XML:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:textSize="23sp"
android:text="The Beach Beneath the Street"
android:fontFamily="sans-serif-medium"
android:textColor="@color/black"
android:textIsSelectable="true"/>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:padding="15dp"
android:fontFamily="sans-serif-condensed"
android:lineHeight="25dp"
android:lineSpacingMultiplier="1"
android:lineSpacingExtra="6dp"
android:textSize="16sp"
android:text="Never add a RecyclerView or ListView to a scroll view"
android:textIsSelectable="true" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
当您android:descendantFocusability="blocksDescendants"在 a 中使用时ViewGroup,它将阻止其所有子视图接收焦点
欲了解更多信息,请查看文档
android:descendantFocusability
定义在寻找要获取焦点的 View 时 ViewGroup 及其后代之间的关系。
必须是以下常量值之一
android:descendantFocusability。
afterDescendants:- 仅当 ViewGroup 的后代都不想要焦点时,ViewGroup 才会获得焦点。beforeDescendants:- ViewGroup 将在其任何后代之前获得焦点。blocksDescendants:- ViewGroup 将阻止其后代接收焦点。现在你的问题
但是添加此行后,textIsSelectable 停止工作。我怎样才能添加这两行?
AFAIK你不能同时使用两者
您需要为片段中自动滚动到底部的问题找到替代解决方案
以下一些链接可能会帮助您解决片段中自动滚动到底部的问题
| 归档时间: |
|
| 查看次数: |
490 次 |
| 最近记录: |