[Solved] How to construct a button on runtime (Android) [closed]

you can create button from code. you can find all the alternative methods of setting attribute in the doc. for example Button button = new Button(this); button.setText(“hi”); button.setId(Id); button.setTextColor(Color.Red); button.setBackgroundResource(R.drawable.icon); buttonlayout.addView(button); 1 solved How to construct a button on runtime (Android) [closed]

[Solved] Boundry around a view

Try this: Border Line inside cardview: <android.support.v7.widget.CardView android:id=”@+id/cardview0″ android:layout_width=”match_parent” android:layout_height=”50dp” android:layout_alignParentTop=”true”> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_marginLeft=”10dp” android:background=”#000000″> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_marginBottom=”0.5dp” android:layout_marginLeft=”0.5dp” android:layout_marginTop=”0.5dp” android:background=”#ffffff”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerVertical=”true” android:layout_gravity=”center_vertical” android:layout_marginLeft=”30dp” android:text=”Circle” android:textColor=”#3B64AE” /> <Spinner android:layout_width=”150dp” android:layout_height=”match_parent” android:layout_alignParentRight=”true”> </Spinner> </RelativeLayout> </RelativeLayout> </android.support.v7.widget.CardView> Border line outside cardview: <RelativeLayout android:layout_width=”match_parent” android:layout_height=”50dp” android:layout_marginLeft=”5dp” android:background=”@drawable/border_line”> <android.support.v7.widget.CardView android:id=”@+id/cardview0″ android:layout_width=”match_parent” android:layout_height=”50dp” android:layout_margin=”1dp” android:layout_alignParentTop=”true”> … Read more

[Solved] How do i do setOnClickListener in Fragment

You can initialize a new onClickListener in for loop. for(int i=0;i<sortableHeaderWrappers.length;i++) { sortableHeaderWrappers[i].setTag((Integer)i); sortableHeaderWrappers[i].setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { //.. place your logic that needs to be executed when click happens. } }) } 0 solved How do i do setOnClickListener in Fragment