Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>LayoutInflater.from(context).inflate(R.layout.okcancelbar, this, true); </code></pre> <p>this line inflate "this" with the layout R.layout.okcancelbar</p> <pre><code>((Button) findViewById(R.id.okcancelbar_ok)).setText(text) </code></pre> <p>it means that there is a button with id "okcancelbar_ok" in the layout okcancelbar ( inflated earlier) Next we assigned to it the text "Ok"</p> <pre><code>((Button) findViewById(R.id.okcancelbar_cancel)).setText(text); </code></pre> <p>same as above, there is a button with id "okcancelbar_cancel" in the layout okcancelbar</p> <p>So this code do : 1) inflate the view R.layout.okcancelbar 2) get the button (declared in the previous layout) with id "okcancelbar_ok" and set the text to "Ok" 3) idem with the button "okcancelbar_cancel" and text "Cancel"</p> <p>The "layout/okcancelbar.xml" layout should be like that : </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;merge xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;include layout="@layout/okcancelbar_button" android:id="@+id/okcancelbar_ok" /&gt; &lt;include layout="@layout/okcancelbar_button" android:id="@+id/okcancelbar_cancel" /&gt; &lt;/merge&gt; </code></pre> <p>There also should be a "values/attrs.xml" that looks like :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;declare-styleable name="OkCancelBar"&gt; &lt;attr name="okLabel" format="string"/&gt; &lt;attr name="cancelLabel" format="string"/&gt; &lt;/declare-styleable&gt; &lt;/resources&gt; </code></pre> <p>And finally the "layout/okcancelbar_button" should looks like :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Button xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/Button&gt; </code></pre> <p>Hope it helps</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload