2015-01-13 76 views
0

我在我的應用程序中有一些數據輸入屏幕。在它們中的每一箇中,屏幕上的最後EditText都不顯示。這是可用的,你可以按下它並鍵入文本,但它也應該可見。 下面是屏幕之一代碼:最後EditText行消失

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/scrollView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.pdrestimator.Main_Activity$Car_Fragment"> 

    <RelativeLayout 
     android:id="@+id/relativeLayout" 
     android:layout_width="match_parent" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     android:layout_height="match_parent" 
     > 


     <TextView 
      android:id="@+id/vinLabel" 
      android:layout_alignParentTop="true" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_marginTop="12dp" 
      android:textSize="20dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="VIN" /> 


     <EditText 
      android:id="@+id/vin" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/carVinLabel" 
      android:layout_marginRight="10dp" 
      android:layout_marginLeft="140dp" 
      android:layout_alignBaseline="@+id/vinLabel" 
      android:ems="10" /> 




     <TextView 
      android:id="@+id/yearLabel" 
      android:layout_below="@+id/vinLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textSize="20dp" 
      android:layout_alignParentLeft="true" 
      android:layout_marginTop="35dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Year" /> 


     <Spinner 
      android:id="@+id/year" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/yearLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBaseline="@+id/yearLabel" 
      android:ems="10" /> 



     <TextView 
      android:id="@+id/makeLabel" 
      android:layout_below="@+id/yearLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:textSize="20dp" 
      android:layout_marginTop="48dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Make" /> 


     <AutoCompleteTextView 
      android:id="@+id/make" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/yearLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBaseline="@+id/makeLabel" 
      android:ems="10" /> 




     <TextView 
      android:id="@+id/modelLabel" 
      android:layout_below="@+id/makeLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:textSize="20dp" 
      android:layout_marginTop="35dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Model" /> 


     <EditText 
      android:id="@+id/model" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/modelLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBaseline="@+id/modelLabel" 
      android:ems="10" /> 




     <TextView 
      android:id="@+id/colorLabel" 
      android:layout_below="@+id/modelLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_marginTop="35dp" 
      android:textSize="20dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Color" /> 


     <AutoCompleteTextView 
      android:id="@+id/color" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/colorLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBaseline="@+id/colorLabel" 
      android:ems="10" /> 


     <TextView 
      android:id="@+id/manufactureDateLabel" 
      android:layout_below="@+id/colorLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:textSize="20dp" 
      android:layout_marginTop="35dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Manuf. Date" /> 


     <EditText 
      android:id="@+id/manufactureDate" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/manufactureDateLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBaseline="@+id/manufactureDateLabel" 
      android:ems="10" /> 


     <TextView 
      android:id="@+id/stockNumberLabel" 
      android:layout_below="@+id/manufactureDateLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:textSize="20dp" 
      android:layout_marginTop="35dp" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Stock Number" /> 


     <EditText 
      android:id="@+id/stockNumber" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/stockNumberLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBaseline="@+id/stockNumberLabel" 
      android:ems="10" /> 
    </RelativeLayout> 
</ScrollView> 

任何幫助將不勝感激!

+0

如果EditText不可見,如何點擊它? – Rohit5k2

+0

我知道它應該在哪裏:它的標籤右邊,正下方,並與上面的EditText對齊。它在那裏,但光標所在的行不顯示。 –

+0

你可以發佈對你而言可見的'EditText' xml嗎? – Rohit5k2

回答

1
<EditText 
      android:id="@+id/stockNumber" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/stockNumberLabel" 
      android:layout_alignLeft="@+id/vin" 
      android:layout_alignRight="@+id/vin" 
      android:layout_alignBottom="@+id/stockNumberLabel" 
      android:ems="10" /> 

layout_alignBottom代替基線的伎倆!

Worth looking at this

0

使用此

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/scrollView" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.pdrestimator.Main_Activity$Car_Fragment"> 

<RelativeLayout 
    android:id="@+id/relativeLayout" 
    android:layout_width="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:layout_height="wrap_content" 
    > 


    <TextView 
     android:id="@+id/vinLabel" 
     android:layout_alignParentTop="true" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_marginTop="12dp" 
     android:textSize="20dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="VIN" /> 


    <EditText 
     android:id="@+id/vin" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/vinLabel" 
     android:layout_marginRight="10dp" 
     android:layout_marginLeft="140dp" 
     android:layout_alignBaseline="@+id/vinLabel" 
     android:ems="10" /> 




    <TextView 
     android:id="@+id/yearLabel" 
     android:layout_below="@+id/vinLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="20dp" 
     android:layout_alignParentLeft="true" 
     android:layout_marginTop="35dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="Year" /> 


    <Spinner 
     android:id="@+id/year" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/yearLabel" 
     android:layout_alignLeft="@+id/vin" 
     android:layout_alignRight="@+id/vin" 
     android:layout_alignBaseline="@+id/yearLabel" 
     android:ems="10" /> 



    <TextView 
     android:id="@+id/makeLabel" 
     android:layout_below="@+id/yearLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:textSize="20dp" 
     android:layout_marginTop="48dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="Make" /> 


    <AutoCompleteTextView 
     android:id="@+id/make" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/yearLabel" 
     android:layout_alignLeft="@+id/vin" 
     android:layout_alignRight="@+id/vin" 
     android:layout_alignBaseline="@+id/makeLabel" 
     android:ems="10" /> 




    <TextView 
     android:id="@+id/modelLabel" 
     android:layout_below="@+id/makeLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:textSize="20dp" 
     android:layout_marginTop="35dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="Model" /> 


    <EditText 
     android:id="@+id/model" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/modelLabel" 
     android:layout_alignLeft="@+id/vin" 
     android:layout_alignRight="@+id/vin" 
     android:layout_alignBaseline="@+id/modelLabel" 
     android:ems="10" /> 




    <TextView 
     android:id="@+id/colorLabel" 
     android:layout_below="@+id/modelLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_marginTop="35dp" 
     android:textSize="20dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="Color" /> 


    <AutoCompleteTextView 
     android:id="@+id/color" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/colorLabel" 
     android:layout_alignLeft="@+id/vin" 
     android:layout_alignRight="@+id/vin" 
     android:layout_alignBaseline="@+id/colorLabel" 
     android:ems="10" /> 


    <TextView 
     android:id="@+id/manufactureDateLabel" 
     android:layout_below="@+id/colorLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:textSize="20dp" 
     android:layout_marginTop="35dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="Manuf. Date" /> 


    <EditText 
     android:id="@+id/manufactureDate" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/manufactureDateLabel" 
     android:layout_alignLeft="@+id/vin" 
     android:layout_alignRight="@+id/vin" 
     android:layout_alignBaseline="@+id/manufactureDateLabel" 
     android:ems="10" /> 


    <TextView 
     android:id="@+id/stockNumberLabel" 
     android:layout_below="@+id/manufactureDateLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:textSize="20dp" 
     android:layout_marginTop="35dp" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:text="Stock Number" /> 


    <EditText 
     android:id="@+id/stockNumber" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/stockNumberLabel" 
     android:layout_alignLeft="@+id/vin" 
     android:layout_alignRight="@+id/vin" 
     android:layout_alignBottom="@+id/stockNumberLabel" 
     android:ems="10" /> 
</RelativeLayout> 

+0

感謝您的努力,但這沒有奏效。底部EditText的行仍然不可見。 –

+0

當你用我的原始代碼在你的系統上試過它時,是否做過EditText顯示? –

+0

它在這裏可見。我在這裏嘗試過。嘗試更換完整的XML。 – Rohit5k2