android-ui

Android UI examples [closed]

荒凉一梦 提交于 2019-12-03 02:22:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am new with Android UI and I am looking for some resources about best practices to design a UI (examples of UI elements, tutorials, etc.) I've been looking in Google or http://developer.android.com/resources/tutorials but there is nothing helpful at all. Can anyone provide me some resources/links ? 回答1: There

Animation not starting until UI updates or touch event

混江龙づ霸主 提交于 2019-12-03 01:13:00
I have a strange problem with an AlphaAnimation . It is supposed to run repeatedly when an AsyncTask handler is called. However, the first time the handler is called in the Activity , the animation won't start unless I touch the screen or if the UI is updated (by pressing the phone's menu button for example). The strange part is that once the animation has run at least once, it will start without problem if the handler is called again. Here's what the code looks like: // AsyncTask handler public void onNetworkEvent() { this.runOnUiThread(new Runnable() { @Override public void run() {

Android MediaPlayer reset freezes UI

时光毁灭记忆、已成空白 提交于 2019-12-03 00:11:33
I have a problem with the Android MediaPlayer when changing the dataSource of the player. According the specification of the MediaPlayer ( http://developer.android.com/reference/android/media/MediaPlayer.html ) I have to reset the player when changing the dataSource . This works fine, but as soon as the channelChanged method is called twice in quick succession the MediaPlayer.reset freezes the UI. I profile the code as seen here: public void channelChanged(String streamingUrl) { long m1 = System.currentTimeMillis(); mMediaPlayer.reset(); long m2 = System.currentTimeMillis(); try { mMediaPlayer

Is there a simpler/better way to put a border/outline around my TextView?

喜你入骨 提交于 2019-12-02 22:01:09
So I wanted to have a TextView with a cool border around it. I couldn't find any standard way of doing it, so I came up with this: @drawable/custom_bg_1: A blue rounded shape <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#439CC8"/> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> @drawable/custom_bg_2: A white rounded shape <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">

Android - ListViews inside tableLayout

五迷三道 提交于 2019-12-02 21:56:51
问题 I'm trying to build and app that shows organized data so I'm thinking that basically a TableLayout would be a good idea, just to keep them in rows, so I'm wondering whats the correct way to do it? I have this in my xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TableLayout android:id="@+id/tableLayout1" android:layout

What is the alternative to getActionView() before API level11 in android?

血红的双手。 提交于 2019-12-02 21:44:16
getActionView() for action bar was introduced in API 11 , If I want backward compatibility what is the alternative for getActionView() ? e.g. public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.action_bar_menu, menu); final MenuItem item = menu.findItem(R.id.menuitem); item.getActionView() //Works from API level 11 return true; } For backwards compatibility you can use either ActionBarCompat or ActionBarScherlock . In both cases you can use the method getActionView(). You have to be sure that the import, in the first case is from the compatibility library ( android

Style Android SearchView Drop down popup

痴心易碎 提交于 2019-12-02 21:02:21
I would like to know how to style the drop down popup of the Android 4.0 SearchView ? I'm using the Theme.Sherlock.Light.DarkActionBar , but I don't know how to style the drop down search into a white background and a black text? For some reason theming using the "searchAutoCompleteTextView" wasn't working for me either. So I solved it using the following code when setting up my SearchView: Note: This is all done with the android v7 support/AppCompat library public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_menu, menu); MenuItem searchItem = menu.findItem

How to create Android Google Play's Grid View like Widget with different size images loaded dynamically

吃可爱长大的小学妹 提交于 2019-12-02 20:56:46
Hi I have enclosed two app images which has grid view like widgets with different image heights and widths, loaded dynamically ,i need to create the same type of UI ,i could be glad if someone guide me to start with. Pallavi A similar question was asked previously and this is the answer. The developer used Bucket List Adapter to create the google play like list view. 来源: https://stackoverflow.com/questions/13191426/how-to-create-android-google-plays-grid-view-like-widget-with-different-size-im

Disable home button in android

我的梦境 提交于 2019-12-02 18:51:49
问题 I add this code in my activity public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_HOME) { return false; } return super.onKeyDown(keyCode, event); } public void onAttachedToWindow() { super.onAttachedToWindow(); this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); } and the home button is looks like it is disabled But the problem is when someone press the menu button and when my menu button is shown and the user press home button then the

Android - ScrollView like foursquare with maps + list

﹥>﹥吖頭↗ 提交于 2019-12-02 16:26:17
This is the Android equivalent of this iOS question. Trying to create a view that contains a MapView at about 20% of the screen (under an ActionBar...) and the rest of the screen is a ScrollView that when scrolling down, overlaps on top of the MapView and hides it. In short like FourSquare's Android app. Any ideas? I've made an implementation based on AndroidSlidingUpPanel (many thanks to this project). Details http://android.amberfog.com/?p=915 Source code with example: https://github.com/dlukashev/AndroidSlidingUpPanel-foursquare-map-demo LAST UPDATE <RelativeLayout xmlns:android="http:/