Android 编辑文本位于按钮上方
我试了很多次,但都没有。。。我在屏幕顶部有一个图像,一个编辑文本和两个按钮。填充编辑文本,位于按钮上方,用户不能单击“发送”或“取消”。我也尝试过使用“scrollview”,但我有同样的问题Android 编辑文本位于按钮上方,android,Android,我试了很多次,但都没有。。。我在屏幕顶部有一个图像,一个编辑文本和两个按钮。填充编辑文本,位于按钮上方,用户不能单击“发送”或“取消”。我也尝试过使用“scrollview”,但我有同样的问题 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_par
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/inviabackground2"
android:orientation="vertical"
android:layout_weight="1"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/logoinvia" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
</EditText>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invia per mail!" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:text="Annulla" />
</LinearLayout>
</LinearLayout>
这对我很有用。当用户键入时,它会向下滚动
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imageView1"
android:ems="10" >
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText1"
android:layout_alignParentLeft="true"
android:text="Invia per mail!" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText1"
android:layout_toRightOf="@id/button1"
android:layout_alignParentRight="true"
android:text="Annulla" />
</RelativeLayout>
</ScrollView>
以下是布局:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1" xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.30"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imageView1"
android:ems="10" >
</EditText>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.70"
android:gravity="center"
android:weightSum="1">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText1"
android:layout_alignParentLeft="true"
android:text=" mail!"
android:layout_weight="0.50"/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText1"
android:layout_toRightOf="@id/button1"
android:layout_alignParentRight="true"
android:text="xyz"
android:layout_weight="0.50"/>
</LinearLayout>
</LinearLayout>
以下是您的解决方案:
![<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1" xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" />
<ScrollView
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.50"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imageView1"
android:ems="10" >
</EditText>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.50"
android:gravity="center"
android:weightSum="1">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText1"
android:layout_alignParentLeft="true"
android:text=" mail!"
android:layout_weight="0.50"/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText1"
android:layout_toRightOf="@id/button1"
android:layout_alignParentRight="true"
android:text="xyz"
android:layout_weight="0.50"/>
</LinearLayout>
</LinearLayout>
![
你能发布一个屏幕截图吗?我不知道你的意思是什么,为什么在编辑文本之前有一个空的线性布局?因为我没有一个“大”的徽标,我模拟了固定它的高度。为你的情况删除它。正确!酷男孩!按钮总是在编辑文本下面,图像应该固定(不是scrool)嗯?那么你想固定图像和其他滚动的图像?谢谢你的代码!但我只需要EditText scrollable,图像和按钮必须固定在屏幕上。你可以只在textview左右移动scrollview。搜索“scrollview fixed header footer”将给你很多的想法。图片在滚动。我需要有图片和按钮修复。只有编辑文本需要移动。