2015-09-06 33 views
1

我有一個使用Floating Label,當我嘗試導入這個舊項目到Android工作室我面對一些問題Android的 - 我該如何使用FloatingLabel在Android Studio中

其中之一導入浮動標籤庫老項目

enter image description here

更新問題

的回答我,我應該使用TextInputLayout

這裏是示例代碼從我的浮動標籤

<com.hardik.floatinglabel.FloatingLabelView 
      android:id="@+id/mob" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="5dip" 
      android:layout_marginRight="5dip" 
      android:layout_marginTop="5dip" 
      android:padding="5dp" 
      floatview:floatHintText="@string/mob" 
      floatview:floatHintTextColorFocused="@color/blue" 
      floatview:floatHintTextColorUnFocused="@color/green" 
      floatview:floatHintTextStyle="bold" 
      floatview:textBackground="@drawable/edt_bg" /> 

我怎麼可以接近在TextInputLayout

+0

你導入Eclipse項目到Android工作室? – jyoon

+0

是的,但以我的方式,作爲項目結構的手動導入不同 –

+2

用於編輯文本的浮動標籤現在可以通過** Android設計庫**正式獲得。也許你可以刪除圖書館:http://android-developers.blogspot.it/2015/05/android-design-support-library.html –

回答

1

的Android浮動標籤相同的結果在Android設計支持庫進行了介紹,以顯示在EditText上一個浮動標籤。

XML代碼

<android.support.design.widget.TextInputLayout 
    android:id="@+id/input_layout_password" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/input_password" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/hint_email" /> 

</android.support.design.widget.TextInputLayout> 

gradle這個

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:design:23.0.1' 
} 
相關問題