android - How to configure an inner-layout programmatically -


i have layout defined in xml, looks this:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/footer_layout"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal">      <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         android:layout_weight="1"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:gravity="center">          <!-- add views here -->                  </relativelayout>      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/app"/>  </linearlayout> 

i inflating inside activity, relativelayout needs have textviews depending on data application. how possibly extend , add different views in it?


note: different this question because trying figure out how extend inner-layout without using class content want add.

xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/footer_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">  <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id=@+id/inner_layout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:gravity="center">      <!-- add views here -->              </relativelayout>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/app"/>  </linearlayout> 

activity

 relativelayout relativelayout=(relativelayout) findviewbyid(r.id.inner_layout);  relativelayout.addview(//add view here(one allowed)); 

if ordering views in relativelayout use rules. better use linearlayout.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -