Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
how to change buttons background from another activity ?
ghasem deh
Nov 16 2017 10:41 AM
260
Reply
hi, i have 3 XML layout file (in res) with several buttons . i use xml layouts in view pager into main activity in my app ... now i want change buttons background when my condition is true , how do it ?
this my button in XML layout :
<
ir.rahgoshafan.alphabetpuzzle.customs.PuzzleButton
android:id
=
"@+id/btn_green455"
android:layout_width
=
"0dp"
android:layout_height
=
"wrap_content"
android:layout_weight
=
"0.33"
android:onClick
=
"BTN_CLICK"
android:background
=
"@drawable/button_red"
android:contentDescription
=
"@string/app_name"
android:text
=
"?????? ?????"
android:textColor
=
"#fff"
android:textSize
=
"20sp"
android:textStyle
=
"bold"
/>
and view pager in main activity :
private
void
init() {
ViewPager VIEW_PAGER = (ViewPager) findViewById(R.id.tour_view_pager);
DOTS_LAYOUT = (LinearLayout) findViewById(R.id.tour_layout_dots);
LAYOUTS =
new
int
[]{R.layout.items_one, R.layout.items_two, R.layout.items_three};
addBottomDots(
0
);
TourViewPagerAdapter ViewPagerAdapter =
new
TourViewPagerAdapter();
VIEW_PAGER.setAdapter(ViewPagerAdapter);
VIEW_PAGER.addOnPageChangeListener(viewPagerPageChangeListener);
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
xamarin Passing data
Problem with Android studio