Android 布局中的编辑文本不是全宽
我对xml有问题。为什么我的编辑文本不能全屏显示?它显示了大约80%的屏幕宽度,但不是全部Android 布局中的编辑文本不是全宽,android,android-layout,android-widget,android-ui,Android,Android Layout,Android Widget,Android Ui,我对xml有问题。为什么我的编辑文本不能全屏显示?它显示了大约80%的屏幕宽度,但不是全部 <ScrollView android:layout_width="match_parent" android:layout_height="fill_parent" android:background="@color/colorGray" android:layout_weight=".35" > <
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/colorGray"
android:layout_weight=".35" >
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="horizontal|vertical" >
<LinearLayout
android:id="@+id/rightCont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="test" />
</LinearLayout>
</HorizontalScrollView>
</ScrollView>
因为
编辑文本
被包装在一个滚动视图
中,它占据了屏幕的0.35重量。因此,它将展开,直到到达其父视图组的边界。
要测试这一点,请将ScrollView的权重更改为1:
android:layout_weight="1"
因为
EditText
被包装在一个ScrollView
中,它占据了屏幕的0.35重量。因此,它将展开,直到到达其父视图组的边界。
要测试这一点,请将ScrollView的权重更改为1:
android:layout_weight="1"
除了Andy Res所说的之外,不建议在scrollview中使用scrollview。较新的android版本可以处理这个问题,但较旧的版本在确定触摸事件时哪个scrollview应该滚动时会有困难 此外,在EditText周围使用填充父项的换行内容的线性布局也会导致EditText的纯换行内容行为
你应该重新考虑你的布局。除了Andy Res所说的,不建议在scrollview中使用scrollview。较新的android版本可以处理这个问题,但较旧的版本在确定触摸事件时哪个scrollview应该滚动时会有困难 此外,在EditText周围使用填充父项的换行内容的线性布局也会导致EditText的纯换行内容行为 你应该重新考虑你的布局。Hmm。。我的布局设计是:我的xml布局结构如下:
Hmm。。我的布局设计是:我的xml布局结构如下: