2015-12-30 97 views
-3

這是我寫的代碼在我的應用程序中創建按鈕。按鈕沒有在我的Android應用程序中創建

該代碼是好的,但它也沒有得到創建。

<Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:onClick="dosomething" 
      android:text="mybutton" /> 
+0

其中是您的代碼 – Ranjit

+0

發佈完整的XML代碼 – Pankaj

回答

0

使用此。

<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="match_parent" 
tools:context=".MainActivity"> 


<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="New Button" 
    android:id="@+id/button" /> 
</LinearLayout> 
+0

該代碼創建按鈕的上面的代碼如下: - <?XML版本=「1.0」編碼=「UTF-8」> <機器人.support.design.widget.CoordinatorLayout xmlns:android =「http://schemas.android.com/apk/res/android」 xmlns:app =「http://schemas.android.com/apk/res-auto 「 的xmlns:工具=」 http://schemas.android.com/tools 「 的android:layout_width = 」match_parent「 機器人:layout_height = 」match_parent「 機器人:方向= 」橫向「 機器人:fitsSystemWindows =」 真「 工具: context =「com.example.asad.button.MainActivity」> wht – asad

+0

使用我的代碼..是不是在工作? –

+0

我已經使用了CoordinatorLayout。 – asad

相關問題