Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom Layout With XML
    primarykey
    data
    text
    <p>I've got layout in my app which will contain scrolling banner (it is not finnished yet if you look in my XML), and this banner will be used in other activities. So I want to make it a custom layout so I dont copypaste it X number of times.</p> <p>here is my XML (well... I am not sure if all is correct so any criticism in this part is appreciated)</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="match_parent" android:id="@+id/baseID"&gt; &lt;RelativeLayout android:layout_centerInParent="true" android:layout_width="fill_parent" android:layout_height="100dp" android:id="@+id/id1" android:background="#ff00ff"&gt; &lt;Button android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="25dp" android:layout_marginRight="25dp"/&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="1dp" android:layout_alignTop="@id/id1" android:layout_alignBottom="@id/id1" android:id="@+id/id2" android:background="#08000000" android:orientation="horizontal"&gt; &lt;Button android:id="@+id/button1" android:layout_width="20dp" android:layout_height="fill_parent" android:layout_weight="1" android:onClick="onClick" android:text="1" /&gt; &lt;TextView android:layout_height="fill_parent" android:layout_width="wrap_content" android:text="to jest moj tekst" android:layout_weight="16"/&gt; &lt;Button android:id="@+id/button2" android:layout_width="20dp" android:layout_height="fill_parent" android:layout_weight="1" android:onClick="onClick" android:text="1" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>For now this layout contains only banner, but there will be more stuff.</p> <p>THe question is: How do I put it to an external class ?</p> <p>I know that I have to make a new class which extends RelativeLayout(int this case). But what then ? How do I set layout to this class ?</p> <p>Also I've made some research but I didnt find any simple and accurate tutorial for this. If you know any - please post it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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. 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