android-view

Using Hardware Layer in Custom View onDraw

 ̄綄美尐妖づ 提交于 2019-12-12 07:59:51
问题 So I'm trying to understand how I can properly use hardware acceleration (when available) in a custom View that is persistently animating. This is the basic premise of my onDraw() : canvas.drawColor(mBackgroundColor); for (Layer layer : mLayers) { canvas.save(); canvas.translate(layer.x, layer.y); //Draw that number of images in a grid, offset by -1 for (int i = -1; i < layer.xCount - 1; i++) { for (int j = -1; j < layer.yCount - 1; j++) { canvas.drawBitmap(layer.bitmap, layer.w * i, layer.h

Why EditText in a custom compound view is re-using the text entered in another compound view instance?

懵懂的女人 提交于 2019-12-12 07:09:49
问题 I'm trying to write a custom compound view composed by a TextView and an EditText , _compound_view.xml_: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/compoundText" android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/textLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Label" /> <EditText android:id="@+id/textEdit" android:layout_width="match_parent"

how to get the particular sub view id from the view in android?

半世苍凉 提交于 2019-12-12 04:26:01
问题 I created a dynamic view that contains FrameLayout , and it contains ImageView s. Now, when I touch the particular image on frame layout, I want know the ID of the ImageView . So, here are my questions: How can I set the ID for the ImageView ? How can I recognize particular ImageView is touched? Here is the sample snippet of the code: for (int j = 0; j < _pageslist.size(); j++) { FrameLayout frame = new FrameLayout(HLActivity.this); LayoutParams params = new FrameLayout.LayoutParams(

how to extend two classes so that i may set a new activity in view

▼魔方 西西 提交于 2019-12-12 03:07:54
问题 Hi so im trying to make a game that when a red circle is clicked another screen pops up and says they have failed the game. Now as i understand their is multiple ways of doing this i have attempted to make a public static method in my main class that will setContentView to the other screen, but you cannot make that into a static reference. So im kind of stuck as to what to do. public class Main extends Activity { DrawingView v; @Override protected void onCreate(Bundle savedInstanceState) {

Unable to dynamically populate a table

本小妞迷上赌 提交于 2019-12-12 02:58:51
问题 I'm trying to fetch data from a database and placing its content in a Table format. I've looked up various tutorials online and structured my code as follows, but it wouldn't show the data in a table format at all. Works fine when a TextView is used. Here's my code, please know where I'm going wrong. No force close is encountered, just that the data won't display! package com.example.callandmessagemanager; import android.app.Activity; import android.database.Cursor; import android.graphics

Unable to access view outside onCreateView()

我的未来我决定 提交于 2019-12-12 01:56:31
问题 I have trying to update views of fragment from activity.And i am getting nullpointerException. public class MyFragment extends Fragment { TextView tv_date, tv_memo_title; public MyFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_day_summary, container, false); tv_date = (TextView) view.findViewById(R

ListView update after complete AsyncTask

谁说我不能喝 提交于 2019-12-12 00:50:41
问题 I want to update TextView's text using AsyncTask. I have list view in that there is Two TextView and one is ImageView When user press ImageView button the Song will be played from server side. So i have put code in AsyncTask task This is an custom Adapter from that i am calling ImageView's on Click event below is my code sample like this public View getView(final int position, View convertView, ViewGroup parent) { holder.imgPlay.setOnClickListener(new View.OnClickListener() { @Override public

wiring up expandablelistview cascading checkboxes

孤街醉人 提交于 2019-12-12 00:28:52
问题 It's been a great learning experience but i'm finally almost done with my expandablelistview adapter. It has checkboxes on the groups and childviews so, intuitively, you can disable/enable all the checks on the childviews by action of the group view checkbox. all that's left now is to make group view checkbox correspond to the children views. when i try to it crashes. for(int i = 0; i < check_states.get(groupPosition).size(); i++) { if (check_states.get(groupPosition).get(i) == false) { Log.d

how to add clipboard option to action_send intent

大憨熊 提交于 2019-12-12 00:11:49
问题 Somehow I've seen an application that can add Clipboard option to share options. Something like this screenshot How can I do that? I tried to add extra intent, but the additional intent didn't show up Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_TEXT, "Extra Text"); intent.setType("text/plain"); Intent clipboardIntent = new Intent(); clipboardIntent.putExtra(Intent.EXTRA_TEXT, "Extra Text"); clipboardIntent.putExtra(Intent.EXTRA_SUBJECT,

How to Draw Arrowline in android.graphics.Path with correct configerations

醉酒当歌 提交于 2019-12-11 22:21:58
问题 What I have Tried: I'm trying to display the arrow line with following code Path mArrowPath=new Paint();; mArrowPath.rewind(); mArrowPath.moveTo(0, mHeight / 2); mArrowPath.lineTo(mWidth / 2, 0); mArrowPath.lineTo(mWidth, mHeight / 2); mArrowPath.lineTo(mWidth * 3 / 4, mHeight / 2); mArrowPath.lineTo(mWidth * 3 / 4, mHeight); mArrowPath.lineTo(mWidth / 4, mHeight); mArrowPath.lineTo(mWidth / 4, mHeight / 2); mArrowPath.lineTo(0, mHeight / 2); Shape pathshap = new PathShape(mArrowP,maxWidth