Вы находитесь на странице: 1из 5

1.

<Button android:id="@+id/startbutton" android:text="Start" android:visibil


ity="visible"></Button>
2.
<Button android:id="@+id/startbutton_disabled" android:text="Start" androi
d:clickable="false" android:textColor="#999999" android:visibility="gone"></Butt
on>
3.
4.
<Button android:id="@+id/stopbutton" android:text="Stop" android:visibili
ty="gone"></Button>
5.
<Button android:id="@+id/stopbutton_disabled" android:text="Stop" android:
clickable="false" android:textColor="#999999" android:visibility="visible"></But
ton>

1.
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layou
t.widget);
2.
remoteView.setViewVisibility(R.id.startbutton, View.GONE);
3.
remoteView.setViewVisibility(R.id.startbutton_disabled, View.VISIBLE);
4.
remoteView.setViewVisibility(R.id.stopbutton, View.VISIBLE);
5.
remoteView.setViewVisibility(R.id.stopbutton_disabled, View.GONE);
6.
AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteV
iew);

#
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widg
et);
#
remoteView.setViewVisibility(R.id.startbutton, View.VISIBLE);
#
remoteView.setViewVisibility(R.id.startbutton_disabled, View.GONE);
#
remoteView.setViewVisibility(R.id.stopbutton, View.GONE);
#
remoteView.setViewVisibility(R.id.stopbutton_disabled, View.VISIBLE);
#
AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteView)
73/B Kanshari Para Road Opposite NetajiBhawan metro Station Towards harish Mukhe
rjee Road

* android:visibility
Parameters
visibility One of VISIBLE, INVISIBLE, or GONE.

btnEliminar = (Button) findViewById(R.id.btnEliminar);


btnEliminar.setVisibility(4);

Jed said..
This was very helpful and here how I used it..
I like to show and hide button onTouch
1. First when my application loads the button will be hidden..
2. I touch screen, button is displayed
nextPage.setVisibility(0);
3. Touch it again, goes away
nextPage.setVisibility(4);

here is what I did...


//some code
nextPage.setVisibility(4);
//Show/hide button
flipper.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
nextPage.setVisibility(0);

return true;
}
if(event.getAction() == MotionEvent.ACTION_DOWN){
nextPage.setVisibility(4);
return true;
}
return true;
}
})

http://mobiforge.com/designing/story/understanding-user-interface-android-part-2
-views

<ImageButton
android:id="@+id/sound_button"
android:layout_x="430px"
android:layout_y="219px"
android:layout_width="48px"
android:layout_height="48px"
android:scaleType="center"
android:src="@android:drawable/volumeicon"
android:background="@drawable/clearbuttonup"
/>
http://www.stealthcopter.com/blog/2010/04/android-grouping-onclicklisteners-toge
ther-by-implementation-in-an-activity/

1. <supports-screens
2. android:largeScreens="true"
3. android:normalScreens="true"
4. android:smallScreens="true"
5. android:anyDensity="false" />
public class TestActivity extends Activity implements OnClickListener, Animation
Listener {
private ImageView image;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
image = (ImageView) findViewById(R.id.image);
((Button) findViewById(R.id.button)).setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.button) {
Animation animation;
if (image.getVisibility() == View.VISIBLE) {
animation = new BlinkAnimation(3, true);
animation.setInterpolator(new DecelerateInterpolator());
} else {
animation = new BlinkAnimation(3, false);
animation.setInterpolator(new AccelerateInterpolator());
}
animation.setDuration(1000L);
animation.setAnimationListener(this);
image.startAnimation(animation);
}
}
@Override
public void onAnimationEnd(Animation animation) {
image.setVisibility(image.getVisibility() == View.VISIBLE ?
View.INVISIBLE : View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationStart(Animation animation) {}
}
+
+
+
+
+
+
+
+
http://www.wiseandroid.com/post/2010/08/10/Making-a-simple-custom-Android-UI-ani
mation.aspx

Вам также может понравиться