-1
我mnoob android,我有一個簡單的問題。 我有一個RelativeLayout中的TextView,我想動態地添加一個按鈕,該TextView在RelativeLayout中存在, 我該怎麼做? 謝謝!在Android中使用JAVA類製作按鈕
<RelativeLayout 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"
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:background="@mipmap/background"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container">
<android.support.v4.view.ViewPager
android:id="@+id/screen3"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
</android.support.v4.view.ViewPager>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:paddingTop="30dp"
android:id="@+id/act3_txt1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="35sp"
android:textAlignment="center"
android:textColor="#FFFFFF"
/>
<ImageView
android:paddingTop="30dp"
android:id="@+id/cam_images"
android:layout_height="250sp"
android:layout_width="wrap_content"
android:layout_below="@+id/act3_txt1" />
<TextView
android:paddingTop="30dp"
android:id="@+id/act3_txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cam_images"
android:textSize="35sp"
android:textAlignment="center"
android:layout_centerInParent="true"
android:textColor="#FFFFFF"
android:paddingBottom="20dp"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
下面的按鈕請提供一些源代碼。 –
您的問題顯示零研究和零努力解決您自己的問題,請先嚐試一下,如果您有特定問題,請回來。 – Egor
@Egor請參閱下面的評論我嘗試...我很抱歉,我無法發佈後的代碼。我也是在stackOverFlow noob! –